Part Number Hot Search : 
2SC3296 DTC143X EL7301 4ALVC A1540 T345N 99603E3 SP491E
Product Description
Full Text Search
 

To Download TMP86P807MG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  8 bit microcontroller tlcs-870/c series TMP86P807MG
TMP86P807MG the information contained herein is su bject to change without notice. 021023 _ d toshiba is continually working to improve the qual ity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fa il due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utilizing toshiba products , to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that to shiba products are used within specified operating ranges as set forth in the most re cent toshiba products specifications. also, please keep in mind the precautio ns and conditions set forth in the ? handling guide for semiconductor devices, ? or ? toshiba semiconductor reliability handbook ? etc. 021023_a the toshiba products listed in this document are inte nded for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ( ? unintended usage ? ). unintended usage include atomic energy control instruments, airplane or spaceship instruments, tr ansportation instruments, traffic signal instruments, combustion control instruments, medical instrument s, all types of safety devices, etc. unintended usage of toshiba products listed in this document shall be made at the customer's own risk. 021023_b the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohib ited under any applicable laws and regulations. 060106_q the information contained he rein is presented only as a guide for the applications of our products. no responsibility is assumed by tosh iba for any infringements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of toshiba or others. 021023_c the products described in this document may include products subject to the foreign exchange and foreign trade laws. 021023_f for a discussion of how the reliability of microcontro llers can be predicted, please refer to section 1.3 of the chapter entitled quality and reli ability assurance/hand ling precautions. 030619_s ? 2006 toshiba corporation all rights reserved
revision history date revision 2006/5/26 1 first release 2006/9/26 2 contents revised 2007/2/21 3 contents revised 2007/7/7 4 contents revised

i table of contents TMP86P807MG 1.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 pin names and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2. operational description 2.1 cpu core functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1 memory address map ............................................................................................................................... 7 2.1.2 program memory (otp) ........................................................................................................................... 7 2.1.3 data memory (ram) ............................................................................................................................... .. 7 2.2 system clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.1 clock generator ............................................................................................................................... ......... 8 2.2.2 timing generator ............................................................................................................................... ..... 10 2.2.2.1 configuration of timing generator 2.2.2.2 machine cycle 2.2.3 operation mode control circuit .............................................................................................................. 11 2.2.3.1 single-clock mode 2.2.3.2 dual-clock mode 2.2.3.3 stop mode 2.2.4 operating mode control ......................................................................................................................... 16 2.2.4.1 stop mode 2.2.4.2 idle1/2 mode and sleep1/2 mode 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) 2.2.4.4 slow mode 2.3 reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.3.1 external reset input ............................................................................................................................... 29 2.3.2 address trap reset ............................................................................................................................... ... 30 2.3.3 watchdog timer reset .............................................................................................................................. 30 2.3.4 system clock reset ............................................................................................................................... ... 30 3. interrupt control circuit 3.1 interrupt latches (il15 to il2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.2 interrupt enable register (eir) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2.1 interrupt master enable flag (imf) .......................................................................................................... 34 3.2.2 individual interrupt enable flags (ef15 to ef4) ...................................................................................... 34 3.3 interrupt source selector (intsel) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.4 interrupt sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.4.1 interrupt acceptance processing is packaged as follows. ....................................................................... 37 3.4.2 saving/restoring general-purpose registers ............................................................................................ 38 3.4.2.1 using push and pop instructions 3.4.2.2 using data transfer instructions 3.4.3 interrupt return ............................................................................................................................... ......... 40 3.5 software interrupt (intsw) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.5.1 address error detection .......................................................................................................................... 40 3.5.2 debugging ............................................................................................................................... ............... 41
ii 3.6 undefined instruction interrupt (intundef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.7 address trap interrupt (intatrap) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.8 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4. special function r egister (sfr) 4.1 sfr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5. i/o ports 5.1 p0 (p07 to p00) port (high current) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.2 p1 (p12 to p10) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5.3 p2 (p22 to p20) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 5.4 p3 (p37 to p30) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6. time base timer (tbt) 6.1 time base timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.1.1 configuration ............................................................................................................................... ........... 53 6.1.2 control ............................................................................................................................... ..................... 53 6.1.3 function ............................................................................................................................... ................... 54 6.2 divider output (dvo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.2.1 configuration ............................................................................................................................... ........... 55 6.2.2 control ............................................................................................................................... ..................... 55 7. watchdog timer (wdt) 7.1 watchdog timer configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 7.2 watchdog timer control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 7.2.1 malfunction detection methods using the watchdog timer ................................................................... 58 7.2.2 watchdog timer enable ......................................................................................................................... 59 7.2.3 watchdog timer disable ........................................................................................................................ 60 7.2.4 watchdog timer interrupt (intwdt) ...................................................................................................... 60 7.2.5 watchdog timer reset ........................................................................................................................... 61 7.3 address trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 7.3.1 selection of address trap in internal ram (atas) ................................................................................ 62 7.3.2 selection of operation at address trap (atout) .................................................................................. 62 7.3.3 address trap interrupt (intatrap) ....................................................................................................... 62 7.3.4 address trap reset ............................................................................................................................... . 63 8. 16-bit timercounter 1 (tc1) 8.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 8.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 8.3.1 timer mode ............................................................................................................................... .............. 68 8.3.2 external trigger timer mode .................................................................................................................. 70 8.3.3 event counter mode ............................................................................................................................... 72 8.3.4 window mode ............................................................................................................................... .......... 73 8.3.5 pulse width measurement mode ............................................................................................................ 74
iii 8.3.6 programmable pulse generate (ppg) output mode ............................................................................. 77 9. 8-bit timercounter (tc3, tc4) 9.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 9.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 9.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 9.3.1 8-bit timer mode (tc3 and 4) ................................................................................................................ 87 9.3.2 8-bit event counter mode (tc3, 4) ........................................................................................................ 88 9.3.3 8-bit programmable divider ou tput (pdo) mode (tc3, 4) ..................................................................... 88 9.3.4 8-bit pulse width modulation (pwm) output mode (tc3, 4) .................................................................. 91 9.3.5 16-bit timer mode (tc3 and 4) .............................................................................................................. 93 9.3.6 16-bit event counter mode (tc3 and 4) ................................................................................................ 94 9.3.7 16-bit pulse width modulation (pwm) output mode (tc3 and 4) .......................................................... 94 9.3.8 16-bit programmable pulse generate (ppg) output mode (tc3 and 4) ............................................... 97 9.3.9 warm-up counter mode ......................................................................................................................... 99 9.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) 9.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) 10. asynchronous serial interface (uart ) 10.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 10.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10.3 transfer data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.4 transfer rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.5 data sampling method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.6 stop bit length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 10.7 parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 10.8 transmit/receive operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 10.8.1 data transmit operation .................................................................................................................... 106 10.8.2 data receive operation ..................................................................................................................... 106 10.9 status flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 10.9.1 parity error ............................................................................................................................... ........... 107 10.9.2 framing error ............................................................................................................................... ....... 107 10.9.3 overrun error ............................................................................................................................... ....... 107 10.9.4 receive data buffer full ..................................................................................................................... 108 10.9.5 transmit data buffer empty ............................................................................................................... 108 10.9.6 transmit end flag .............................................................................................................................. 109 11. serial expansion interface (sei) 11.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 11.2 sei registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 11.2.1 sei control register (secr) .............................................................................................................. 112 11.2.1.1 transfer rate 11.2.2 sei status register (sesr) ............................................................................................................... 113 11.2.3 sei data register (sedr) .................................................................................................................. 113 11.3 sei operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 11.3.1 controlling sei clock polarity and phase ............................................................................................ 114 11.3.2 sei data and clock timing ................................................................................................................... 114 11.4 sei pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 11.4.1 sclk pin ............................................................................................................................... .............. 115 11.4.2 miso/mosi pins ............................................................................................................................... .. 115
iv 11.4.3 ss pin ............................................................................................................................... .................. 115 11.5 sei transfer formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 11.5.1 cpha (secr register bit 2) = 0 format .............................................................................................. 116 11.5.2 cpha = 1 format ............................................................................................................................... .. 116 11.6 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 11.7 interrupt generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 11.8 sei system errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 11.8.1 write collision error ............................................................................................................................. 1 19 11.8.2 overflow error ............................................................................................................................... ...... 119 11.9 bus driver protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 12. 8-bit ad converter (adc) 12.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 12.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 12.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 12.3.1 ad conveter operation ...................................................................................................................... 124 12.3.2 ad converter operation ..................................................................................................................... 124 12.3.3 stop and slow mode during ad conversion ................................................................................. 125 12.3.4 analog input voltage and ad conversion result ............................................................................... 126 12.4 precautions about ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 12.4.1 analog input pin voltage range ........................................................................................................... 127 12.4.2 analog input shared pins .................................................................................................................... 127 12.4.3 noise countermeasure ........................................................................................................................ 127 13. key-on wakeup (kwu) 13.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 13.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 14. otp operation 14.1 operating mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 14.1.1 mcu mode ............................................................................................................................... ........... 131 14.1.1.1 program memory 14.1.1.2 data memory 14.1.1.3 input/output circuiry 14.1.2 prom mode ............................................................................................................................... ........ 132 14.1.2.1 programming flowchart (high-speed program writing) 14.1.2.2 program writing using a general-purpose prom programmer 15. input/output circuitry 15.1 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 15.2 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 16. electrical characteristics 16.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 16.2 operating condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 16.3 dc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
v 16.4 ad conversion characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 16.5 sei operating condition (slave mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 16.6 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 16.7 dc characteristics, ac characteristics (prom mode) . . . . . . . . . . . . . . . . . . . 144 16.7.1 read operation in prom mode .......................................................................................................... 144 16.7.2 program operation (high-speed) (topr = 25 5 c) ........................................................................... 145 16.8 recommended oscillation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 16.9 handling precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 17. package dimensions this is a technical docu ment that describes the operat ing functions and electrical specifications of the 8-bit microc ontroller series tlcs-870/c (lsi).
vi
page 1 060116ebp TMP86P807MG cmos 8-bit microcontroller ? the information contained herein is subject to change without notice. 021023_d ? toshiba is continually working to improve the quality and reli ability of its products. neverthel ess, semiconductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vul nerability to physical stre ss. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of sa fety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, pleas e ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precautions and conditions set forth in the ?handling gui de for semiconductor devices,? or ?toshiba se miconductor reliability handbook? etc. 021023_a ? the toshiba products listed in this document are intended for usage in general electronics applic ations (computer, personal eq uip- ment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neithe r intended nor warranted for usage in equipment that requires extr aordinarily high quality and/or re liability or a malfunctionor failure of which may cause loss of human life or bod ily injury (?unintended usage?). unintended us age include atomic energy control instru ments, airplane or spaceship instruments, transporta tion instruments, traffic signal instrume nts, combustion control instruments, medi cal instru- ments, all types of safety dev ices, etc. unintended usage of toshiba products li sted in this document shall be made at the cust omer's own risk. 021023_b ? the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and /or sale are prohibited under any appl icable laws and regulations. 060106_q ? the information contained herein is present ed only as a guide for the applications of our products. no responsibility is assum ed by toshiba for any infringements of patents or other rights of the th ird parties which may result from its use. no license is gran ted by impli- cation or otherwise under any patent or patent rights of toshiba or others. 021023_c ? the products described in this document are subjec t to the foreign exchange and foreign trade laws. 021023_e ? for a discussion of how the reliability of microcontrollers c an be predicted, please refer to section 1.3 of the chapter entit led quality and reliability assurance/h andling precautions. 030619_s TMP86P807MG the TMP86P807MG is a single-chip 8-bit high-speed a nd high-functionality microcomputer incorporating 8192 bytes of one-time prom. it is pin-compatible wi th the tmp86c807mg/tmp86c407mg (mask rom version). the TMP86P807MG can realize operations equivalent to those of the tmp86c807mg/tmp86c407mg by pro- gramming the on-chip prom. 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c series - instruction execution time : 0.25 s (at 16 mhz) 122 s (at 32.768 khz) - 132 types & 731 basic instructions 2. 17interrupt sources (external : 5 internal : 12) 3. input / output ports (22 pins) large current output: 8pins (typ. 20ma), led direct drive 4. prescaler - time base timer - divider output function 5. watchdog timer 6. 16-bit timer counter: 1 ch - timer, external trigger, wi ndow, pulse width measurement, event counter, programmable pulse generate (ppg) modes 7. 8-bit timer counter : 2 ch - timer, event counter, programmable divider output (pdo), product no. rom (eprom) ram package maskrom mcu emulation chip TMP86P807MG 8192 bytes 256 bytes sop28-p-450-1.27b tmp86c807mg/ tmp86c407mg tmp86c908xb
page 2 1.1 features TMP86P807MG pulse width modulation (pwm) output, programmable pulse generation (ppg) modes 8. 8-bit uart : 1 ch 9. 8bit serial expansion in terface (sei): 1 channel (msb/lsb selectable and max. 4mbps at 16mhz) 10. 8-bit successive approximation type ad converter (with sample hold) analog inputs: 6ch 11. key-on wakeup : 4 channels 12. clock operation single clock mode dual clock mode 13. low power consumption operation stop mode: oscillation stops. (battery/capacitor back-up.) slow1 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock stop.) slow2 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock oscillate.) idle0 mode: cpu stops, and only the time-based-tim er(tbt) on peripherals operate using high fre- quency clock. release by falling edge of th e source clock which is set by tbtcr. idle1 mode: cpu stops and peripherals operate us ing high frequency clock. release by interru- puts(cpu restarts). idle2 mode: cpu stops and peripherals operate usin g high and low frequency clock. release by inter- ruputs. (cpu restarts). sleep0 mode: cpu stops, and only the time-based-t imer(tbt) on peripherals operate using low fre- quency clock.release by falling edge of th e source clock which is set by tbtcr. sleep1 mode: cpu stops, and peripherals operate using low frequency clock. release by interru- put.(cpu restarts). sleep2 mode: cpu stops and peripherals operate using high and low frequency clock. release by interruput. 14. wide operation voltage: 4.5 v to 5.5 v at 16 mhz /32.768 khz 2.7 v to 5.5 v at 8 mhz /32.768 khz
page 3 TMP86P807MG 1.2 pin assignment figure 1-1 pin assignment 28 27 26 25 24 23 22 21 20 19 18 17 16 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 vss xout test vdd (xtin) p21 (xtout) p22 reset ( stop / int5 ) p20 (txd) p00 (rxd) p01 xin (sclk) p02 (miso) p04 (mosi) p03 p06 (int3/ ppg ) p10 ( int0 ) p11 (int1) p12 ( dvo ) p30 (tc3/ pdo3/pwm3 ) p07 (int4/tc1) p36 (ain4/stop4) p37 (ain5/stop5) p35 (ain3/stop3) p33 ain1 p32 ain0 p31 tc4/ pdo4/pwm4/ppg4 p34 (ain2/stop2) p05 ( ss )
page 4 1.3 block diagram TMP86P807MG 1.3 block diagram figure 1-2 block diagram
page 5 TMP86P807MG 1.4 pin names and functions the TMP86P807MG has mcu mode and prom mode. tabl e 1-1 shows the pin functions in mcu mode. the prom mode is explained later in a separate chapter. table 1-1 pin names and functions(1/2) pin name pin number input/output functions p07 int4 tc1 17 io i i port07 external interrupt 4 input tc1 input p06 int3 ppg 16 io i o port06 external interrupt 3 input ppg output p05 ss 15 io i port05 sei master/slave select input p04 miso 14 io i port04 sei master input, slave output p03 mosi 13 io i port03 sei master input, slave output p02 sclk 12 io io port02 sei serial clock input/output pin p01 rxd 11 io i port01 uart data input p00 txd 10 io o port00 uart data output p12 dvo 20 io o port12 divider output p11 int1 19 io i port11 external interrupt 1 input p10 int0 18 io i port10 external interrupt 0 input p22 xtout 7 io o port22 resonator connecting pins(32.768 khz) for inputting external clock p21 xtin 6 io i port21 resonator connecting pins(32.768 khz) for inputting external clock p20 int5 stop 9 io i i port20 external interrupt 5 input stop mode release signal input p37 ain5 stop5 28 io i i port37 ad converter analog input 5 stop5 p36 ain4 stop4 27 io i i port36 ad converter analog input 4 stop4 p35 ain3 stop3 26 io i i port35 ad converter analog input 3 stop3
page 6 1.4 pin names and functions TMP86P807MG p34 ain2 stop2 25 io i i port34 ad converter analog input 2 stop2 p33 ain1 24 io i port33 ad converter analog input 1 p32 ain0 23 io i port32 ad converter analog input 0 p31 tc4 pdo4/pwm4/ppg4 22 io i o port31 tc4 input pdo4/pwm4/ppg4 output p30 tc3 pdo3/pwm3 21 io i o port30 tc3 input pdo3/pwm3 output xin 2 i resonator connecting pins for high-frequency clock xout 3 o resonator connecting pins for high-frequency clock reset 8 i reset signal test 4 i test pin for out-going test. normally, be fixed to low. vdd 5 i +5v vss 1 i 0(gnd) table 1-1 pin names and functions(2/2) pin name pin number input/output functions
page 7 TMP86P807MG 2. operational description 2.1 cpu core functions the cpu core consists of a cpu, a system cl ock controller, and an interrupt controller. this section provides a description of the cpu core, the program memory, the data memory, and the reset circuit. 2.1.1 memory address map the TMP86P807MG memory is composed otp, ram and sfr(special function register). they are all mapped in 64-kbyte address space. figure 2-1 shows the TMP86P807MG memory address map. figure 2-1 memory address map 2.1.2 program memory (otp) the TMP86P807MG has a 8192 bytes (address e000 h to ffffh) of program memory (otp ). 2.1.3 data memory (ram) the TMP86P807MG has 256bytes (address 0040h to 013f h) of internal ram. the first 192 bytes (0040h to 00ffh) of the internal ram are locat ed in the direct area; instructions with shorten operations are available against such an area. the data memory contents become un stable when the power supply is turned on; therefore, the data memory should be initialized by an initialization routine. sfr 0000 h 64 bytes sfr: ram: special function register includes: i/o ports peripheral control registers peripheral status registers system control registers program status word random access memory includes: data memory stack 003f h ram 0040 h 256 bytes 013f h e000 h otp: program memory otp 8192 bytes ffc0 h vector table for vector call instructions (32 bytes) ffdf h ffe0 h vector table for interrupts (32 bytes) ffff h
page 8 2. operational description 2.2 system clock controller TMP86P807MG 2.2 system clock controller the system clock controller consists of a clock generator, a timing generator, and a standby controller. figure 2-2 syst em colck control 2.2.1 clock generator the clock generator generates the basic clock which pr ovides the system clocks supplied to the cpu core and peripheral hardware. it contains two oscillation ci rcuits: one for the high-frequency clock and one for the low-frequency clock. power consumption can be reduced by switching of the standby controller to low-power operation based on the low-frequency clock. the high-frequency (fc) clock and low-frequency (fs) clock can easily be obtained by connecting a resonator between the xin/xout and xtin/xtout pins respectively. clock input from an exte rnal oscillator is also possible. in this case, external clock is applied to xin/xtin pin with xout/xtout pin not connected. example :clears ram to ?00h?. (TMP86P807MG) ld hl, 0040h ; start address setup ld a, h ; initial value (00h) setup ld bc, 00ffh sramclr: ld (hl), a inc hl dec bc jrs f, sramclr tbtcr syscr2 syscr1 xin xout xtin xtout fc 0036 h 0038 h 0039 h fs timing generator control register timing generator standby controller system clocks clock generator control high-frequency clock oscillator low-frequency clock oscillator clock generator system control registers
page 9 TMP86P807MG figure 2-3 examples of resonator connection note:the function to monitor the basic clock directly at external is not provided for hardware, however, with dis- abling all interrupts and watchdog timers, the oscillation frequency can be adjusted by monitoring the pulse which the fixed frequency is outputted to the port by the program. the system to require the adjustment of the oscilla tion frequency should create the program for the adjust- ment in advance. xout xin (open) xout xin xtout xtin (open) xtout xtin (a) crystal/ceramic resonator (b) external oscillator (c) crystal (d) external oscillator high-frequency clock low-frequency clock
page 10 2. operational description 2.2 system clock controller TMP86P807MG 2.2.2 timing generator the timing generator generates the various system cloc ks supplied to the cpu core and peripheral hardware from the basic clock (fc or fs). the timing generator provides the following functions. 1. generation of main system clock 2. generation of divider output ( dvo ) pulses 3. generation of source clocks for time base timer 4. generation of source clocks for watchdog timer 5. generation of internal source clocks for timer/counters 6. generation of warm-up clocks for releasing stop mode 2.2.2.1 configuration of timing generator the timing generator consists of a 2-stage prescaler, a 21-stage divider, a main system clock generator, and machine cycle counters. an input clock to the 7th stage of the divider depends on the operating mode, syscr2 and tbtcr, that is shown in figure 2-4. as reset and stop mode star ted/canceled, the prescaler and the divider are cleared to ?0?. figure 2-4 configurat ion of timing generator multi- plexer high-frequency clock fc low-frequency clock fs divider sysck fc/4 fc or fs machine cycle counters main system clock generator 1 2 1 4 3 2 8 7 10 9 12 11 14 13 16 15 dv7ck multiplexer warm-up controller watchdog timer a s b y s b0 a0 y0 b1 a1 y1 5 6 17 18 19 20 21 timer counter, serial interface, time-base-timer, divider output, etc. (peripheral functions)
page 11 TMP86P807MG note 1: in single clock mode, do not set dv7ck to ?1?. note 2: do not set ?1? on dv7ck while the low-frequency clock is not operated stably. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 4: in slow1/2 and sleep1/2 modes, the dv7ck setting is ineffective, and fs is input to the 7th stage of the divider. note 5: when stop mode is entered from normal1/2 mode, the dv 7ck setting is ineffective during the warm-up period after release of stop mode, and the 6th stage of the divider is input to the 7th stage during this period. 2.2.2.2 machine cycle instruction execution and peripheral hardware operat ion are synchronized with the main system clock. the minimum instruction execution uni t is called an ?machine cycle?. th ere are a total of 10 different types of instructions for the tlcs-870/c series: ra nging from 1-cycle instructions which require one machine cycle for execution to 10-cyc le instructions which require 10 machine cycles fo r execution. a machine cycle consists of 4 states (s0 to s3), and each state consists of one main system clock. figure 2-5 machine cycle 2.2.3 operation mode control circuit the operation mode control circuit starts and stops th e oscillation circuits for the high-frequency and low- frequency clocks, and switches the main system clock. there are three operating modes: single clock mode, dual clock mode and stop mode. these modes are cont rolled by the system cont rol registers (syscr1 and syscr2). figure 2-6 shows the operating mode transition diagram. 2.2.3.1 single-clock mode only the oscillation circuit for the high-frequenc y clock is used, and p21 (xtin) and p22 (xtout) pins are used as input/output ports . the main-system clock is obtained from the high-frequency clock. in the single-clock mode, the machine cycle time is 4/fc [s]. (1) normal1 mode in this mode, both the cpu core and on-chip pe ripherals operate using the high-frequency clock. the TMP86P807MG is placed in this mode after reset. timing generator control register tbtcr (0036h) 76543210 (dvoen) (dvock) dv7ck (tbten) (tbtck) (initial value: 0000 0000) dv7ck selection of input to the 7th stage of the divider 0: fc/2 8 [hz] 1: fs r/w main system clock state machine cycle s3 s2 s1 s0 s3 s2 s1 s0 1/fc or 1/fs [s]
page 12 2. operational description 2.2 system clock controller TMP86P807MG (2) idle1 mode in this mode, the internal oscillation circuit remains active. the cpu and the watchdog timer are halted; however on-chip peripherals remain active (operate using the high-frequency clock). idle1 mode is started by syscr2 = "1", and idle1 mode is released to normal1 mode by an interrupt request from the on-chip peri pherals or external interrupt inputs. when the imf (interrupt master enable flag) is ?1? (interrupt enable), the execution will resume with the acceptance of the interrupt, and the operation will return to nor mal after the interrupt service is completed. when the imf is ?0? (interrupt disable), the execution will resume with the instruction which follows the idle1 mode start instruction. (3) idle0 mode in this mode, all the circuit, except oscillator an d the timer-base-timer, stops operation. this mode is enabled by syscr2 = "1". when idle0 mode starts, the cpu stops and the timing generator stops feeding the clock to the peripheral circuits other than tbt. then, upon de tecting the falling edge of the source clock selected with tbtcr, the timing generator starts feeding the clock to al l peripheral circuits. when returned from idle0 mode, the cpu rest arts operating, entering normal1 mode back again. idle0 mode is entered and returned regardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individu al enable flag) = ?1?, and tb tcr = ?1?, interrupt pro- cessing is performed. when idle0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to normal1 mode. 2.2.3.2 dual-clock mode both the high-frequency and low-frequency oscillatio n circuits are used in th is mode. p21 (xtin) and p22 (xtout) pins cannot be used as input/output ports. the main system clock is obtained from the high-frequency clock in normal2 and idle2 modes, and is obtained from the low-frequency clock in slow and sleep modes. th e machine cycle time is 4/fc [s] in the normal2 and idle2 modes, and 4/fs [s] (122 s at fs = 32.768 khz) in the slow and sleep modes. the tlcs-870/c is placed in the signal-clock mode during reset. to use the dual-clock mode, the low- frequency oscillator should be turned on at the start of a program. (1) normal2 mode in this mode, the cpu core operates with the high-frequency clock. on-chip peripherals operate using the high-frequency clock and/or low-frequency clock. (2) slow2 mode in this mode, the cpu core operates with the lo w-frequency clock, while both the high-frequency clock and the low-frequency clock are operated. as the syscr2 becomes "1", the hard- ware changes into slow2 mode. as the syscr2 becomes ?0?, the hardware changes into normal2 mode. as the syscr2 beco mes ?0?, the hardware changes into slow1 mode. do not clear syscr2 to ?0? during slow2 mode. (3) slow1 mode this mode can be used to reduce power-consu mption by turning off oscillation of the high-fre- quency clock. the cpu core and on-chip peri pherals operate using th e low-frequency clock.
page 13 TMP86P807MG switching back and forth between slow1 and slow2 modes are performed by syscr2. in slow1 and sleep modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (4) idle2 mode in this mode, the internal oscillation circuit remain active. the cpu and the watchdog timer are halted; however, on-chip peripherals remain activ e (operate using the high-frequency clock and/or the low-frequency clock). starting and releasing of idle2 mode are the same as for idle1 mode, except that operation re turns to normal2 mode. (5) sleep1 mode in this mode, the internal oscillation circuit of the low-frequency clock remains active. the cpu, the watchdog timer, and the internal oscillation circuit of the high-frequency clock are halted; how- ever, on-chip peripherals remain active (operate us ing the low-frequency clock). starting and releas- ing of sleep mode are the same as for idle1 mo de, except that operation returns to slow1 mode. in slow1 and sleep1 modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (6) sleep2 mode the sleep2 mode is the idle mode corresponding to the slow2 mode. the status under the sleep2 mode is same as that under the sleep1 mo de, except for the oscilla tion circuit of the high- frequency clock. (7) sleep0 mode in this mode, all the circuit, except oscillator and the timer-base-timer, stops operation. this mode is enabled by setting ?1? on bit syscr2. when sleep0 mode starts, the cp u stops and the timing generator stops feeding the clock to the peripheral circuits other than tbt. then, upon de tecting the falling edge of the source clock selected with tbtcr, the timing generator starts feeding the clock to al l peripheral circuits. when returned from sleep0 mode, the cpu restarts operating, entering slow1 mode back again. sleep0 mode is entered and returned re gardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individual enable flag ) = ?1?, and tbtcr = ?1?, interrupt pro- cessing is performed. when sleep0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to slow1 mode. 2.2.3.3 stop mode in this mode, the internal oscillation circuit is turned off, causing all system operations to be halted. the internal status immediately prior to the halt is held with a lowest power consumption during stop mode. stop mode is started by the syst em control register 1 (syscr1), an d stop mode is released by a inputting (either level-sensitive or edge-sens itive can be programmably selected) to the stop pin. after the warm-up period is completed, the execution resumes with the instruction which follows the stop mode start instruction.
page 14 2. operational description 2.2 system clock controller TMP86P807MG note 1: normal1 and normal2 modes are generically called no rmal; slow1 and slow2 are called slow; idle0, idle1 and idle2 are called idle; sleep0, sleep1 and sleep2 are called sleep. note 2: the mode is released by fa lling edge of tbtcr setting. figure 2-6 operating mode transition diagram table 2-1 operating mode and conditions operating mode oscillator cpu core tbt other peripherals machine cycle time high frequency low frequency single clock reset oscillation stop reset reset reset 4/fc [s] normal1 operate operate operate idle1 halt idle0 halt stop stop halt ? dual clock normal2 oscillation oscillation operate with high frequency operate operate 4/fc [s] idle2 halt slow2 operate with low frequency 4/fs [s] sleep2 halt slow1 stop operate with low frequency sleep1 halt sleep0 halt stop stop halt ? note 2 syscr2 = "1" stop pin input stop pin input stop pin input interrupt interrupt syscr2 = "0" syscr2 = "1" syscr2 = "0" syscr2 = "0" syscr1 = "1" syscr1 = "1" syscr1 = "1" syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" reset release normal1 mode idle0 mode (a) single-clock mode idle1 mode normal2 mode idle2 mode syscr2 = "1" slow2 mode sleep2 mode slow1 mode sleep1 mode sleep0 mode reset (b) dual-clock mode stop syscr2 = "1" note 2
page 15 TMP86P807MG note 1: always set retm to ?0? when transiting from normal mode to stop mode. always set retm to ?1? when transiting from slow mode to stop mode. note 2: when stop mode is released with reset pin input, a return is made to normal1 regardless of the retm contents. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *; don?t care note 4: bits 0 and 1 in syscr1 are read as undefined data when a read instruction is executed. note 5: as the hardware becomes stop mode under outen = ?0?, input value is fixed to ?0?; therefore it may cause external interrupt request on account of falling edge. note 6: when the key-on wakeup is used, relm should be set to "1". note 7: in case of setting as stop mode is released by a rising edge of stop pin input, the release setting by stop5 to stop2 on stopcr register is prohibited. note 8: port p20 is used as stop pin. therefore, when stop mode is started, outen does not affect to p20, and p20 becomes high-z mode. note 9: the warmig-up time should be set correctly for using oscillator. note 1: a reset is applied if both xen and xten are cleared to ?0?, xen is cleared to ?0? when sysck = ?0?, or xten is cleared to ?0? when sysck = ?1?. note 2: *: don?t care, tg: timing generator note 3: bits 3, 1 and 0 in syscr2 are always read as undefined value. note 4: do not set idle and tghalt to ?1? simultaneously. note 5: because returning from idle0/sleep0 to normal1/slow 1 is executed by the asynchronous internal clock, the period of idle0/sleep0 mode might be shorter than the period setting by tbtcr. note 6: when idle1/2 or sleep1/2 mode is rel eased, idle is automatically cleared to ?0?. note 7: when idle0 or sleep0 mode is released, tghalt is automatically cleared to ?0?. system control register 1 syscr176543210 (0038h) stop relm retm outen wut (initial value: 0000 00**) stop stop mode start 0: cpu core and peripherals remain active 1: cpu core and peripherals are halted (start stop mode) r/w relm release method for stop mode 0: edge-sensitive release 1: level-sensitive release r/w retm operating mode after stop mode 0: return to normal1/2 mode 1: return to slow1 mode r/w outen port output during stop mode 0: high impedance 1: output kept r/w wut warm-up time at releasing stop mode return to normal mode return to slow mode r/w 00 01 10 11 3 x 2 16 /fc 2 16 /fc 3 x 2 14 /fc 2 14 /fc 3 x 2 13 /fs 2 13 /fs 3 x 2 6 /fs 2 6 /fs system control register 2 syscr2 (0039h) 76543210 xen xten sysck idle tghalt (initial value: 1000 *0**) xen high-frequency oscillator control 0: turn off oscillation 1: turn on oscillation r/w xten low-frequency oscillator control 0: turn off oscillation 1: turn on oscillation sysck main system clock select (write)/main system clock moni- tor (read) 0: high-frequency clock (normal1/normal2/idle1/idle2) 1: low-frequency clock (slow1/slow2/sleep1/sleep2) idle cpu and watchdog timer control (idle1/2 and sleep1/2 modes) 0: cpu and watchdog timer remain active 1: cpu and watchdog timer are stopped (start idle1/2 and sleep1/2 modes) r/w tghalt tg control (idle0 and sleep0 modes) 0: feeding clock to all peripherals from tg 1: stop feeding clock to peripherals except tbt from tg. (start idle0 and sleep0 modes)
page 16 2. operational description 2.2 system clock controller TMP86P807MG note 8: before setting tghalt to ?1?, be sure to stop peripheral s. if peripherals are not stopped, the interrupt latch of periph erals may be set after idle0 or sleep0 mode is released. 2.2.4 operating mode control 2.2.4.1 stop mode stop mode is controlled by the system control register 1, the stop pin input and key-on wakeup input (stop5 to stop2) which are controlled by the stop mode release cont rol register (stopcr). the stop pin is also used both as a port p20 and an int5 (external interrupt input 5) pin. stop mode is started by setting syscr1 to ?1?. during stop mode, the following status is maintained. 1. oscillations are turned off, and all internal operations are halted. 2. the data memory, registers, the program status wo rd and port output latches are all held in the status in effect before stop mode was entered. 3. the prescaler and the divider of th e timing generator are cleared to ?0?. 4. the program counter holds the address 2 ahead of th e instruction (e.g., [set (syscr1).7]) which started stop mode. stop mode includes a level-sensitive mode and an edge-sensitive mode, either of which can be selected with the syscr1. do not use any key-on wakeup input (stop5 to stop2) for releas- ing stop mode in edge-sensitive mode. note 1: the stop mode can be released by either the stop or key-on wakeup pins (stop5 to stop2). however, because the stop pin is different from the key-on wakeup and can not inhibit the release input, the stop pin must be used for releasing stop mode. note 2: during stop period (from start of stop mode to end of warm up), due to changes in the external interrupt pin signal, interrupt latches may be set to ?1? and interrupts may be accepted immediately after stop mode is released. before starting stop mode, therefore, disable interrupts. also, before enabling interrupts after stop mode is rel eased, clear unnecessary interrupt latches. (1) level-sensitive release mode (relm = ?1?) in this mode, stop mode is released by setting the stop pin high or detecting high or low edge input for the stop5 to stop2 pins which are enab led by stopcr. this mode is used for capacitor backup when the main power supply is cut off and long term battery backup. even if an instruction for star ting stop mode is executed while stop pin input is high, stop mode does not start but instead the warm-up sequenc e starts immediately. th us, to start stop mode in the level-sensitive release mode, it is nece ssary for the program to first confirm that the stop pin input is low. the following two methods can be used for confirmation. 1. testing a port. 2. using an external interrupt input int5 ( int5 is a falling edge-sensitive input). example 1 :starting stop mode from normal mode by testing a port p20. ld (syscr1), 01010000b ; sets up the level-sensitive release mode sstoph: test (p2prd). 0 ; wait until the stop pin input goes low level jrs f, sstoph di ; imf 0 set (syscr1). 7 ; starts stop mode
page 17 TMP86P807MG figure 2-7 level-s ensitive release mode note 1: even if the stop pin input is low after warm-up start, the stop mode is not restarted. note 2: in this case of changing to the level-s ensitive mode from the edge-s ensitive mode, the release mode is not switched until a rising edge of the stop pin input is detected. (2) edge-sensitive release mode (relm = ?0?) in this mode, stop mode is released by a rising edge of the stop pin input. this is used in appli- cations where a relatively short pr ogram is executed repeat edly at periodic intervals. this periodic signal (for example, a clock from a low-power consumption oscillator) is input to the stop pin. in the edge-sensitive release mode, stop mode is started even when the stop pin input is high level. do not use any stop5 to stop2 pin inputs for releasing stop mode in edge-sensitive release mode. example 2 :starting stop mode from normal mode with an int5 interrupt. pint5: test (p2prd). 0 ; to reject noise, stop mode does not start if jrs f, sint5 port p20 is at high ld (syscr1), 01010000b ; sets up the level-sensitive release mode. di ; imf 0 set (syscr1). 7 ; starts stop mode sint5: reti example :starting stop mode from normal mode di ; imf 0 ld (syscr1), 10010000b ; starts after specified to the edge-sensitive release mode v ih normal operation warm up stop operation confirm by program that the stop pin input is low and start stop mode. always released if the stop pin input is high. stop pin xout pin stop mode is released by the hardware. normal operation
page 18 2. operational description 2.2 system clock controller TMP86P807MG figure 2-8 edge-sensitive release mode stop mode is released by the following sequence. 1. in the dual-clock mode, when returning to normal2, both the high-frequency and low- frequency clock oscillators are turned on; when returning to slow1 mode, only the low- frequency clock oscillator is turned on. in the single-clock mode, only the high-frequency clock oscillator is turned on. 2. a warm-up period is inserted to allow oscillation time to stabilize. during warm up, all internal operations remain halted. four differ ent warm-up times can be selected with the syscr1 in accordance with the resonator characteristics. 3. when the warm-up time has elapsed, normal operation resumes with the instruction follow- ing the stop mode start instruction. note 1: when the stop mode is released, the start is made after the prescaler and the divider of the timing generator are cleared to "0". note 2: stop mode can also be released by inputting low level on the reset pin, which immediately performs the normal reset operation. note 3: when stop mode is released with a low hold voltage, the following cautions must be observed. the power supply voltage must be at the operating voltage level before releasing stop mode. the reset pin input must also be ?h? level, rising together with the power supply voltage. in this case, if an external time const ant circuit has been connected, the reset pin input voltage will increase at a slower pace than the power supply vo ltage. at this time, there is a danger that a reset may occur if input voltage level of the reset pin drops below the non-inverting high-level input voltage (hysteresis input). note 1: the warm-up time is obtained by dividing the ba sic clock by the divider. therefore, the warm-up time may include a certain amount of error if ther e is any fluctuation of the oscillation frequency when stop mode is released. thus, the warm -up time must be considered as an approximate value. table 2-2 warm-up time example (at fc = 16.0 mhz, fs = 32.768 khz) wut warm-up time [ms] return to normal mode return to slow mode 00 01 10 11 12.288 4.096 3.072 1.024 750 250 5.85 1.95 normal operation normal operation v ih stop mode is released by the hardware at the rising edge of stop pin input. warm up stop mode started by the program. stop operation stop operation stop pin xout pin
page 19 TMP86P807MG figure 2-9 stop mode start/release instruction address a + 4 0 instruction address a + 3 turn on turn on warm up 0 n halt set (syscr1). 7 turn off (a) stop mode start (example: start with set (syscr1). 7 instruction located at address a) a + 6 a + 5 a + 4 a + 3 a + 2 n + 2 n + 3 n + 4 a + 3 n + 1 instruction address a + 2 2 1 0 3 (b) stop mode release count up turn off halt oscillator circuit program counter instruction execution divider main system clock oscillator circuit stop pin input program counter instruction execution divider main system clock
page 20 2. operational description 2.2 system clock controller TMP86P807MG 2.2.4.2 idle1/2 mode and sleep1/2 mode idle1/2 and sleep1/2 modes are controlled by the system control register 2 (syscr2) and maskable interrupts. the following status is maintained during these modes. 1. operation of the cpu and watchdog timer (wdt) is halted. on-chip peripherals continue to operate. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before these modes were entered. 3. the program counter holds the address 2 ahead of th e instruction which starts these modes. figure 2-10 idle1/ 2 and sleep1/2 modes reset reset input ?0? ?1? (interrupt release mode) yes no no cpu and wdt are halted interrupt request imf interrupt processing normal release mode yes starting idle1/2 and sleep1/2 modes by instruction execution of the instruc- tion which follows the idle1/2 and sleep1/2 modes start instruction
page 21 TMP86P807MG ? start the idle1/2 and sleep1/2 modes after imf is set to "0", set the individual inte rrupt enable flag (ef) which releases idle1/2 and sleep1/2 modes. to start idle1/2 and sl eep1/2 modes, set syscr2 to ?1?. ? release the idle1 /2 and sleep1/2 modes idle1/2 and sleep1/2 modes include a normal release mode and an interrupt release mode. these modes are selected by interrupt master en able flag (imf). after releasing idle1/2 and sleep1/2 modes, the syscr2 is automa tically cleared to ?0? and the operation mode is returned to the mode preced ing idle1/2 and sleep1/2 modes. idle1/2 and sleep1/2 modes can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. (1) normal release mode (imf = ?0?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled by the individual interrupt enable flag (ef). after the interrupt is ge nerated, the program operation is resumed from the instruction following the idle1/2 and sleep1/2 mo des start instruction. normally, the interrupt latches (il) of the interrupt source used for releas ing must be cleared to ?0? by load instructions. (2) interrupt release mode (imf = ?1?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled with the individual interrupt enable flag (ef) and the interrupt processi ng is started. after the interrupt is processed, the program operation is resumed from the instruction following the instruction, which starts idle1/2 and sleep1/2 modes. note: when a watchdog timer interrupts is generated immediately before idle1/2 and sleep1/2 modes are started, the watchdog timer interrupt will be processed but idle1/2 and sleep1/2 modes will not be started.
page 22 2. operational description 2.2 system clock controller TMP86P807MG figure 2-11 idle1/2 and sleep1/2 modes start/release halt halt halt halt operate instruction address a + 2 a + 3 a + 2 a + 4 a + 3 a + 3 halt set (syscr2). 4 operate operate operate acceptance of interrupt ?r:w normal release mode ?s:w interrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer (a) idle1/2 and sleep1/2 modes start (example: star ting with the set instruction located at address a) (b) idle1/2 and sleep1/2 modes release
page 23 TMP86P807MG 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) idle0 and sleep0 modes are controlled by the system control register 2 (syscr2) and the time base timer control register (tbtcr). the following stat us is maintained during idle0 and sleep0 modes. 1. timing generator stops feeding clock to peripherals except tbt. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before idle0 and sleep0 modes were entered. 3. the program counter holds the address 2 ahead of the instru ction which starts idle0 and sleep0 modes. note: before starting idle0 or sleep0 mode, be sure to stop (disable) peripherals. figure 2-12 idle 0 and sleep0 modes yes (normal release mode) yes (interrupt release mode) no yes reset input cpu and wdt are halted reset tbt source clock falling edge tbtcr = "1" interrupt processing imf = "1" yes tbt interrupt enable no no no no stopping peripherals by instruction yes starting idle0, sleep0 modes by instruction execution of the instruction which follows the idle0, sleep0 modes start instruction
page 24 2. operational description 2.2 system clock controller TMP86P807MG ? start the idle0 and sleep0 modes stop (disable) peripherals such as a timer counter. to start idle0 and sleep0 modes, set syscr2 to ?1?. ? release the idle0 and sleep0 modes idle0 and sleep0 modes include a normal re lease mode and an interrupt release mode. these modes are selected by inte rrupt master flag (imf), the i ndividual interrupt enable flag of tbt and tbtcr. after releasing idle0 and sleep0 modes, the syscr2 is automatically cleared to ?0? and the operatio n mode is returned to the mode preceding idle0 and sleep0 modes. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. idle0 and sleep0 modes can also be re leased by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. note: idle0 and sleep0 modes start/release wi thout reference to tbtcr setting. (1) normal release mode (imf ? ef6 ? tbtcr = ?0?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr. after the falling edge is detect ed, the program operation is resumed from the instruction following the idle0 and sleep0 modes start instruction. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. (2) interrupt release mode (imf ? ef6 ? tbtcr = ?1?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr and inttbt interrupt processing is started. note 1: because returning from idle0, sleep0 to normal1, slow1 is executed by the asynchro- nous internal clock, the period of idle0, sleep0 mode might be the shorter than the period set- ting by tbtcr. note 2: when a watchdog timer interrupt is generat ed immediately before idle0/sleep0 mode is started, the watchdog timer interrupt will be processed but idle0/sleep0 mode will not be started.
page 25 TMP86P807MG figure 2-13 idle0 and slee p0 modes start/release halt halt operate instruction address a + 2 halt operate set (syscr2). 2 halt operate acceptance of interrupt halt ?r:w normal release mode ?s:w interrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock tbt clock tbt clock program counter instruction execution watchdog timer main system clock program counter instruction execution watchdog timer a + 3 a + 2 a + 4 a + 3 a + 3 (a) idle0 and sleep0 modes start (example: starting with the set instruction located at address a (b) idle and sleep0 modes release
page 26 2. operational description 2.2 system clock controller TMP86P807MG 2.2.4.4 slow mode slow mode is controlled by the sy stem control register 2 (syscr2). the following is the methods to switch the mode with the warm-up counter. (1) switching from normal2 mode to slow1 mode first, set syscr2 to switch the main system clock to the low-frequency clock for slow2 mode. next, clear syscr2 to turn off high-frequency oscillation. note: the high-frequency clock can be co ntinued oscillation in order to return to normal2 mode from slow mode quickly. always turn off oscillat ion of high-frequency clock when switching from slow mode to stop mode. example 1 :switching from normal2 mode to slow1 mode. set (syscr2). 5 ; syscr2 1 (switches the main system clock to the low-frequency clock for slow2) clr (syscr2). 7 ; syscr2 0 (turns off high-frequency oscillation) example 2 :switching to the slow1 mode after low-frequency clock has stabilized. set (syscr2). 6 ; syscr2 1 ld (tc3cr), 43h ; sets mode for tc4, 3 (16-bit mode, fs for source) ld (tc4cr), 05h ; sets warming-up counter mode ldw (ttreg3), 8000h ; sets warm-up time (depend on oscillator accompanied) di ; imf 0 set (eirh). 3 ; enables inttc4 ei ; imf 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 set (syscr2). 5 ; syscr2 1 (switches the main system cl ock to the low-frequency clock) clr (syscr2). 7 ; syscr2 0 (turns off high-frequency oscillation) reti : vinttc4: dw pinttc4 ; inttc4 vector table
page 27 TMP86P807MG (2) switching from slow1 mode to normal2 mode note: after sysck is cleared to ?0?, executing the in structions is continiued by the low-frequency clock for the period synchronized with low-frequency and high-frequency clocks. first, set syscr2 to turn on the high-fre quency oscillation. when time for stabilization (warm up) has been taken by the timer/counter (tc4,tc3), clear syscr2 to switch the main system clock to the high-frequency clock. slow mode can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. example :switching from the slow1 mode to the normal2 mode (fc = 16 mhz, warm-up time is 4.0 ms). set (syscr2). 7 ; syscr2 1 (starts high-frequency oscillation) ld (tc3cr), 63h ; sets mode for tc4, 3 (16-bit mode, fc for source) ld (tc4cr), 05h ; sets warming-up counter mode ld (ttreg4), 0f8h ; sets warm-up time di ; imf 0 set (eirh). 3 ; enables inttc4 ei ; imf 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 clr (syscr2). 5 ; syscr2 0 (switches the main system clock to the high-frequency clock) reti : vinttc4: dw pinttc4 ; inttc4 vector table high-frequency clock low-frequency clock main system clock sysck
page 28 2. operational description 2.2 system clock controller TMP86P807MG figure 2-14 switching between the normal2 and slow modes set (syscr2). 7 normal2 mode clr (syscr2). 7 set (syscr2). 5 normal2 mode turn off (a) switching to the slow mode slow1 mode slow2 mode clr (syscr2). 5 (b) switching to the normal2 mode high- frequency clock low- frequency clock main system clock instruction execution sysck xen high- frequency clock low- frequency clock main system clock instruction execution sysck xen slow1 mode warm up during slow2 mode
page 29 TMP86P807MG 2.3 reset circuit the TMP86P807MG has four types of reset generation procedur es: an external reset input, an address trap reset, a watchdog timer reset and a system clock re set. of these reset, the address trap reset, the watchdog timer and the sys- tem clock reset are a malfunction reset. when the malfunction reset request is detected, reset occurs during the max- imum 24/fc[s]. the malfunction reset circuit such as watchdog timer reset, address trap reset and system clock reset is not initial- ized when power is turned on. therefore, reset may occur during maximum 24/fc[s] (1.5 s at 16.0 mhz) when power is turned on. table 2-3 shows on-chip hardware initialization by reset action. 2.3.1 external reset input the reset pin contains a schmitt trigger (hysteresis) with an internal pull-up resistor. when the reset pin is held at ?l? level for at least 3 machin e cycles (12/fc [s]) wi th the power supply volt- age within the operating voltage range and oscillation stab le, a reset is applied and the internal state is initial- ized. when the reset pin input goes high, the reset operation is rele ased and the program execution starts at the vector address stored at addresses fffeh to ffffh. figure 2-15 reset circuit table 2-3 initializing internal status by reset action on-chip hardware initial value on-chip hardware initial value program counter (pc) (fffeh) prescaler and divider of timing generator 0 stack pointer (sp) not initialized general-purpose registers (w, a, b, c, d, e, h, l, ix, iy) not initialized jump status flag (jf) not initialized watchdog timer enable zero flag (zf) not initialized output latches of i/o ports refer to i/o port circuitry carry flag (cf) not initialized half carry flag (hf) not initialized sign flag (sf) not initialized overflow flag (vf) not initialized interrupt master enable flag (imf) 0 interrupt individual enable flags (ef) 0 control registers refer to each of control register interrupt latches (il) 0 ram not initialized internal reset reset vdd malfunction reset output circuit watchdog timer reset address trap reset system clock reset
page 30 2. operational description 2.3 reset circuit TMP86P807MG 2.3.2 address trap reset if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip ram (when wdtcr1 is set to ?1?) or sfr area, address trap reset will be gener- ated. the reset time is maximum 24/fc[s] (1.5 s at 16.0 mhz). note:the operating mode under address tr apped is alternative of reset or interrupt. the address trap area is alter- native. note 1: address ?a? is on-chip ram (wdtcr1 = ?1?) space or sfr area. note 2: during reset release, reset vector ?r? is read out, and an instruction at address ?r? is fetched and decoded. figure 2-16 addr ess trap reset 2.3.3 watchdog timer reset refer to section ?watchdog timer?. 2.3.4 system clock reset if the condition as follows is detected, the system clock reset occurs automatically to prevent dead lock of the cpu. (the oscillation is continued without stopping.) - in case of clearing syscr2 an d syscr2 simultaneously to ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 1 ? . the reset time is maximum 24/fc (1.5 s at 16.0 mhz). instruction at address r 16/fc [s] maximum 24/fc [s] instruction execution internal reset jp a reset release address trap is occurred 4/fc to 12/fc [s]
page 31 TMP86P807MG
page 32 2. operational description 2.3 reset circuit TMP86P807MG
page 33 TMP86P807MG 3. interrupt control circuit the TMP86P807MG has a total of 17 interrupt sources ex cluding reset, of which 1 source levels are multiplexed. interrupts can be nested with priorities. four of the internal interrupt sour ces are non-maskable while the rest are maskable. interrupt sources are provided with interrupt latches (il) , which hold interrupt requests, and independent vectors. the interrupt latch is set to ?1? by th e generation of its interrupt request wh ich requests the cpu to accept its inter- rupts. interrupts are enabled or disabled by software using the interrupt master enable fl ag (imf) and in terrupt enable flag (ef). if more than one interrupts are generated simultaneously, interrup ts are accepted in order which is domi- nated by hardware. however, there are no prioritized interrupt factors among non-maskable interrupts. note 1: the intsel register is used to select the interrupt source to be enabled for each multiplexed source level (see 3.3 inte r- rupt source selector (intsel)). note 2: to use the address trap interrupt (intatrap), clear wdtcr1 to ?0? (it is set for the ?reset request? after reset is cancelled). for details , see ?address trap?. note 3: to use the watchdog timer interrupt (intwdt), clear wdtcr1 to "0" (it is set for the "reset request" after reset is released). for details, see "watchdog timer". 3.1 interrupt latches (il15 to il2) an interrupt latch is provided for eac h interrupt source, except for a software interrupt and an executed the unde- fined instruction interrupt. when interrupt request is genera ted, the latch is set to ?1?, and the cpu is requested to accept the interrupt if its interrupt is enabled. the interrupt latch is cleared to "0" immediately after accepting inter- rupt. all interrupt latches are initialized to ?0? during reset. the interrupt latches are located on address 003ch and 003d h in sfr area. each latch can be cleared to "0" indi- vidually by instruction. however, il2 and il3 should not be cleared to "0" by software. for clearing the interrupt latch, load instruction should be used and then il2 and il3 should be set to "1". if the read-modify-write instructions such as bit manipulation or operation instructions are used, interrupt request would be cleared inadequately if inter- rupt is requested while such instructions are executed. interrupt latches are not set to ?1? by an instruction. since interrupt latches can be read, the status fo r interrupt requests can be monitored by software. interrupt factors enable condition interrupt latch vector address priority internal/external (reset) non-maskable ? fffe 1 internal intswi (software interrupt) non-maskable ? fffc 2 internal intundef (executed the undefined instruction interrupt) non-maskable ? fffc 2 internal intatrap (address trap interrupt) non-maskable il2 fffa 2 internal intwdt (watchdog timer interrupt) non-maskable il3 fff8 2 external int0 imf? ef4 = 1, int0en = 1 il4 fff6 5 external int1 imf? ef5 = 1 il5 fff4 6 internal inttbt imf? ef6 = 1 il6 fff2 7 internal inttc1 imf? ef7 = 1 il7 fff0 8 internal intrxd imf? ef8 = 1 il8 ffee 9 internal inttxd imf? ef9 = 1 il9 ffec 10 internal inttc3 imf? ef10 = 1 il10 ffea 11 internal inttc4 imf? ef11 = 1, il11er = 0 il11 ffe8 12 external int3 imf? ef11 = 1, il11er = 1 internal intadc imf? ef12 = 1 il12 ffe6 13 internal intsei1 imf? ef13 = 1 il13 ffe4 14 external int4 imf? ef14 = 1 il14 ffe2 15 external int5 imf? ef15 = 1 il15 ffe0 16
page 34 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86P807MG note: in main program, before manipulating the interrupt enable flag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf new ly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0 " automatically, clearing imf need not execute normally on interrupt service routine. however, if using multiple inte rrupt on interrupt service routine, manipulating ef or il should be executed before setting imf="1". 3.2 interrupt enab le register (eir) the interrupt enable register (eir) enables and disables the acceptance of interrupts, except fo r the non-maskable interrupts (software interrupt, undefined instruction interr upt, address trap interrupt and watchdog interrupt). non- maskable interrupt is accepted regardless of the contents of the eir. the eir consists of an interrupt mast er enable flag (imf) and the individua l interrupt enable flags (ef). these registers are located on address 003ah and 003bh in sfr ar ea, and they can be read and written by an instructions (including read-modify-write instructions such as bit manipulation or operation instructions). 3.2.1 interrupt ma ster enable flag (imf) the interrupt enable register (imf ) enables and disables the acceptance of the whole maskable interrupt. while imf = ?0?, all maskable interrupts are not accepted regardless of the status on each individual interrupt enable flag (ef). by setting imf to ?1?, the interrupt becomes acceptable if the individuals are enabled. when an interrupt is accepted, imf is cleared to ?0? after the latest status on imf is stacked. thus the maskable inter- rupts which follow are disabled. by executing return interrupt instruction [reti/retn], the stacked data, which was the status before interrup t acceptance, is loaded on imf again. the imf is located on bit0 in eirl (address: 003ah in sfr), and can be read and written by an instruction. the imf is normally set and cl eared by [ei] and [di] instruction respectively. during reset, the imf is initial- ized to ?0?. 3.2.2 individual interrupt enable flags (ef15 to ef4) each of these flags enables and disables the acceptan ce of its maskable interrupt . setting the corresponding bit of an individual interrupt enable flag to ?1? enables acceptan ce of its interrupt, and setting the bit to ?0? dis- ables acceptance. during reset, all the i ndividual interrupt enable flags (ef15 to ef4) ar e initialized to ?0? and all maskable interrupts are not accepted until they are set to ?1?. note:in main program, before manipulating the interrupt enable flag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf become s "0" automatically, clearing imf need not execute nor- mally on interrupt service routine. however, if using mult iple interrupt on interrupt service routine, manipulat- ing ef or il should be executed before setting imf="1". example 1 :clears interrupt latches di ; imf 0 ldw (ill), 111010000011 1111b ; il12, il10 to il6 0 ei ; imf 1 example 2 :reads interrupt latchess ld wa, (ill) ; w ilh, a ill example 3 :tests interrupt latches test (ill). 7 ; if il7 = 1 then jump jr f, sset
page 35 TMP86P807MG example 1 :enables interrupts individually and sets imf di ; imf 0 ldw : (eirl), 1110100010100000b ; ef15 to ef13, ef11, ef7, ef5 1 note: imf should not be set. : ei ; imf 1 example 2 :c compiler description example unsigned int _io (3ah) eirl; /* 3ah shows eirl address */ _di(); eirl = 10100000b; : _ei();
page 36 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86P807MG note 1: to clear any one of bits il7 to il4, be sure to write "1" into il2 and il3. note 2: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". note 3: do not clear il with read-modify-w rite instructions such as bit operations. note 1: *: don?t care note 2: do not set imf and the interrupt enable flag (ef15 to ef4) to ?1? at the same time. note 3: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". interrupt latches (initial value: 00000000 000000**) ilh,ill (003dh, 003ch) 1514131211109876543210 il15 il14 il13 il12 il11 il10 il9 il8 il7 il6 il5 il4 il3 il2 ilh (003dh) ill (003ch) il15 to il2 interrupt latches at rd 0: no interrupt request 1: interrupt request at wr 0: clears the interrupt request 1: (interrupt latch is not set.) r/w interrupt enable registers (initial value: 00000000 0000***0) eirh,eirl (003bh, 003ah) 1514131211109876543210 ef15 ef14 ef13 ef12 ef11 ef10 ef9 ef8 ef7 ef6 ef5 ef4 imf eirh (003bh) eirl (003ah) ef15 to ef4 individual-interrupt enable flag (specified for each bit) 0: 1: disables the acceptance of each maskable interrupt. enables the acceptance of each maskable interrupt. r/w imf interrupt master enable flag 0: 1: disables the acceptance of all maskable interrupts enables the acceptance of all maskable interrupts
page 37 TMP86P807MG 3.3 interrupt sour ce selector (intsel) each interrupt source that shares the interrupt source level with another interrupt source is allowed to enable the interrupt latch only when it is selected in the intsel register. the interrupt controller does not hold interrupt requests corresponding to interrupt sour ces that are not selected in the intsel register. th erefore, the intsel reg- ister must be set appropriately befo re interrupt requests are generated. the following interrupt sources share their interrupt sour ce level; the source is selected onnthe register intsel. 1. inttc4 and int3 share the interrupt source level whose priority is 12. note: always set "0" to bit 5 of intsel register. 3.4 interrupt sequence an interrupt request, which raised inte rrupt latch, is held, until interrupt is accepted or interrupt latch is cleared to ?0? by resetting or an instruct ion. interrupt acceptance sequence requires 8 machine cycles (2 s @16 mhz) after the completion of the current instruction. the interrupt service task terminates upon execution of an interrupt return instruction [reti] (for maskable interrupts) or [retn] (for non-maskable interrupts). figure 3-1 shows the timing chart of interrupt acceptance processing. 3.4.1 interrupt acceptance proc essing is packaged as follows. a. the interrupt master enab le flag (imf) is cleared to ?0? in or der to disable the acceptance of any fol- lowing interrupt. b. the interrupt latch (il) for the interrupt source accepted is cleared to ?0?. c. the contents of the program coun ter (pc) and the program status word, including the interrupt master enable flag (imf), are saved (pushed) on the st ack in sequence of psw + imf, pch, pcl. mean- while, the stack pointer (s p) is decremented by 3. d. the entry address (interrupt vect or) of the corresponding interrupt service program, loaded on the vec- tor table, is transferred to the program counter. e. the instruction stored at the entry address of the inte rrupt service program is executed. note:when the contents of psw are saved on the stack, the contents of imf are also saved. interrupt sour ce selector intsel (003eh) 76543210 - - - il11er - - - - (initial value: ***0 ****) il11er selects inttc4 or int3 0: inttc4 1: int3 r/w
page 38 3. interrupt control circuit 3.4 interrupt sequence TMP86P807MG note 1: a: return address entry address, b: entry address, c: address which reti instruction is stored note 2: on condition that interrupt is enabled, it takes 38/fc [s ] or 38/fs [s] at maximum (if the interrupt latch is set at the first machine cycle on 10 cycle instruction) to start interrupt acceptance processing since its interrupt latch is set. figure 3-1 timing chart of interrupt acceptance/return in terrupt instruction example: correspondence be tween vector table address for inttbt an d the entry address of the interrupt service program a maskable interrupt is not accepted until the imf is set to ?1? even if th e maskable interrupt higher than the level of current servicing interrupt is requested. in order to utilize nested interrupt service, the imf is set to ?1? in the interrupt service program. in this case, acceptable interrupt sources are selectively en abled by the individual interrupt enable flags. to avoid overloaded nesting, clear the individual interrupt enable flag whose interrupt is currently serviced, before setting imf to ?1?. as for non-maskable interr upt, keep interrupt service shorten compared with length between interrupt requests; otherwise the status cannot be recovered as non-maskable interrupt would simply nested. 3.4.2 saving/restoring general-purpose registers during interrupt acceptance processing , the program counter (pc) and the program status word (psw, includes imf) are automati cally saved on the stack, but the accumulato r and others are not. these registers are saved by software if necessary. when multiple interrupt se rvices are nested, it is also necessary to avoid using the same data memory area for saving registers. the fo llowing methods are used to save/restore the general- purpose registers. 3.4.2.1 using push and pop instructions if only a specific register is saved or interrupts of the same source are nested , general-purpose registers can be saved/restored using the push/pop instructions. a b a c + 1 execute instruction sp pc execute instruction n n ? 2 n - 3 n ? 2n ? 1 n ? 1 n a + 2 a + 1 c + 2 b + 3 b + 2 b + 1 a + 1 a a ? 1 execute reti instruction interrupt acceptance execute instruction interrupt service task 1-machine cycle interrupt request interrupt latch (il) imf d2h 03h d203h d204h 06h vector table address entry address 0fh vector interrupt service program fff2h fff3h
page 39 TMP86P807MG 3.4.2.2 using data transfer instructions to save only a specific register wi thout nested interrupts, data tran sfer instructions are available. figure 3-2 saving/restoring general-purpose r egisters under interrupt processing example :save/store register us ing push and pop instructions pintxx: push wa ; save wa register (interrupt processing) pop wa ; restore wa register reti ; return example :save/store register us ing data transfer instructions pintxx: ld (gsava), a ; save a register (interrupt processing) ld a, (gsava) ; restore a register reti ; return pcl pch psw at acceptance of an interrupt at execution of push instruction at execution of reti instruction at execution of pop instruction b-4 b-3 b-2 b-1 b pcl pch psw pcl pch psw sp address (example) sp sp sp a w b-5 interrupt acceptance interrupt service task restoring registers saving registers interrupt return saving/restoring general-purpose registers using push/pop data transfer instruction main task
page 40 3. interrupt control circuit 3.5 software interrupt (intsw) TMP86P807MG 3.4.3 interrupt return interrupt return instructions [reti]/[retn] perform as follows. as for address trap interrupt (intatrap), it is requir ed to alter stacked data for program counter (pc) to restarting address, during interrupt service program. note:if [retn] is executed with the above data unaltered, the program returns to the address trap area and intatrap occurs again.when interrupt acceptance pr ocessing has completed, stacked data for pcl and pch are located on address (sp + 1) and (sp + 2) respectively. interrupt requests are sampled during the final cycle of the instruction being executed. thus, the next inter- rupt can be accepted immediat ely after the interrupt retu rn instruction is executed. note 1: it is recommended that stack pointer be return to rate before intatrap (increment 3 times), if return inter- rupt instruction [retn] is not utilized during inte rrupt service program under intatrap (such as example 2). note 2: when the interrupt processing time is longer than the interrupt request generation time, the interrupt service task is performed but not the main task. 3.5 software interrupt (intsw) executing the swi instruction generates a software interr upt and immediately starts interrupt processing (intsw is highest prioritized interrupt). use the swi instruction only for detection of the address error or for debugging. 3.5.1 address error detection ffh is read if for some cause such as noise the cpu attempts to fetch an instruction from a non-existent memory address during single chip mode. code ffh is th e swi instruction, so a software interrupt is gener- ated and an address error is detect ed. the address error detection range can be further expanded by writing ffh to unused areas of the program memory. address trap reset is generated in case that an instruction is fetched from ram or sfr areas. [reti]/[retn] interrupt return 1. program counter (pc) and program status word (psw, includes imf) are restored from the stack. 2. stack pointer (sp) is incremented by 3. example 1 :returning from address trap interrupt (intatrap) service program pintxx: pop wa ; recover sp by 2 ld wa, return address ; push wa ; alter stacked data (interrupt processing) retn ; return example 2 :restarting without returning interrupt (in this case, psw (includes imf) befo re interrupt acceptance is discarded.) pintxx: inc sp ; recover sp by 3 inc sp ; inc sp ; (interrupt processing) ld eirl, data ; set imf to ?1? or clear it to ?0? jp restart address ; jump into restarting address
page 41 TMP86P807MG 3.5.2 debugging debugging efficiency can be increased by placing the swi instruction at the software break point setting address. 3.6 undefined instruct ion interrupt (intundef) taking code which is not defined as authorized instru ction for instruction causes intundef. intundef is gen- erated when the cpu fetches such a co de and tries to execute it. intundef is accepted even if non-maskable inter- rupt is in process. contemporary process is broken and intundef interrupt process starts, soon after it is requested. note: the undefined instruction interrupt (intundef) forces cpu to jump into vector address, as software interrupt (swi) does. 3.7 address trap interrupt (intatrap) fetching instruction from unauthorized area for instructio ns (address trapped area) cause s reset output or address trap interrupt (intatrap). intatrap is accepted even if non-maskable interrupt is in process. contemporary pro- cess is broken and intatrap interrupt pro cess starts, soon afte r it is requested. note: the operating mode under address trapped, whether to be reset output or interrupt processing, is selected on watchdog timer control register (wdtcr). 3.8 external interrupts the TMP86P807MG has 5 external interrupt inputs. these in puts are equipped with di gital noise reject circuits (pulse inputs of less than a certa in time are elimin ated as noise). edge selection is also possible with int1,int3,int4. the int0 /p10 pin can be configured as either an external interrupt input pin or an input/output port, a nd is configured as an input port during reset. edge selection, noise reject control and int0 /p10 pin function selection are performed by the external interrupt control register (eintcr).
page 42 3. interrupt control circuit 3.8 external interrupts TMP86P807MG note 1: in normal1/2 or idle1/2 mode, if a signal with no noise is input on an external interrupt pin, it takes a maximum of "si g- nal establishment time + 6/fs[s]" from the input signal's edge to set the interrupt latch. note 2: when int0en = "0", il4 is not set even if a falling edge is detected on the int0 pin input. note 3: when a pin with more than one function is used as an out put and a change occurs in data or input/output status, an inter - rupt request signal is generated in a pseudo manner. in this ca se, it is necessary to perform appropriate processing such as disabling the interrupt enable flag. source pin enable conditions release edge (level) digital noise reject int0 int0 imf ? ef4 ? int0en=1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int1 int1 imf ? ef5 = 1 falling edge or rising edge pulses of less than 15/fc or 63/fc [s] are elimi- nated as noise. pulses of 49/fc or 193/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are considered to be signals. int3 int3 imf ? ef11 = 1 and +.'4 falling edge, rising edge, falling and rising edge or h level pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int4 int4 imf ? ef14 = 1 falling edge, rising edge, falling and rising edge or h level pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int5 int5 imf ? ef15 = 1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals.
page 43 TMP86P807MG note 1: fc: high-frequency clock [hz], *: don?t care note 2: when the system clock frequency is switched between high and low or when the external interrupt control register (eintcr) is overwritten, the noise canceller may not operat e normally. it is recommended that external interrupts are dis- abled using the interrupt enable register (eir). note 3: the maximum time from modifying int1 nc until a noise reject time is changed is 2 6 /fc. note 4: in case reset pin is released while the state of int3 pin keeps "h" level, the external interrupt 3 request is not generated even if the int3 edge select is specified as "h" level. the rising edge is needed after reset pin is released. note 5: in case reset pin is released while the state of int4 pin keeps "h" level, the external interrupt 4 request is not generated even if the int4 edge select is specified as "h" level. the rising edge is needed after reset pin is released. external interrupt control register eintcr76543210 (0037h) int1nc int0en int3es int4es int1es (initial value: 0000 000*) int1nc noise reject time select 0: pulses of less than 63/fc [s] are eliminated as noise 1: pulses of less than 15/fc [s] are eliminated as noise r/w int0en p10/ int0 pin configuration 0: p10 input/output port 1: int0 pin (port p10 should be set to an input mode) r/w int4 es int4 edge select 00: rising edge 01: falling edge 10: rising edge and falling edge 11: "h" level r/w int3 es int3 edge select 00: rising edge 01: falling edge 10: rising edge and falling edge 11: "h" level r/w int1 es int1 edge select 0: rising edge 1: falling edge r/w
page 44 3. interrupt control circuit 3.8 external interrupts TMP86P807MG
page 45 TMP86P807MG 4. special function register (sfr) the TMP86P807MG adopts the memory mapped i/o system, an d all peripheral control and data transfers are per- formed through the special function register (sfr). the sfr is mapped on address 0000h to 003fh. this chapter shows the arrangem ent of the special function re gister (sfr) for TMP86P807MG. 4.1 sfr address read write 0000h p0dr 0001h p1dr 0002h p2dr 0003h p3dr 0004h reserved 0005h reserved 0006h reserved 0007h reserved 0008h reserved 0009h p1cr 000ah p3cr 000bh p0outcr 000ch p0prd - 000dh p2prd - 000eh adccr1 000fh adccr2 0010h tc1dral 0011h tc1drah 0012h tc1drbl 0013h tc1drbh 0014h tc1cr 0015h reserved 0016h reserved 0017h reserved 0018h reserved 0019h reserved 001ah tc3cr 001bh tc4cr 001ch ttreg3 001dh ttreg4 001eh pwreg3 001fh pwreg4 0020h adcdr1 - 0021h adcdr2 - 0022h reserved 0023h reserved 0024h reserved 0025h uartsr uartcr1 0026h - uartcr2 0027h rdbuf tdbuf
page 46 4. special function register (sfr) 4.1 sfr TMP86P807MG note 1: do not access reserved areas by the program. note 2: ? ; cannot be accessed. note 3: write-only registers and interrupt latches cannot use the read-modify-write instructions (bit manipulation instructions such as set, clr, etc. and logical operation instructions such as and, or, etc.). 0028h - 0029h reserved 002ah 002bh reserved 002ch reserved 002dh reserved 002eh reserved 002fh reserved 0030h reserved 0031h - stopcr 0032h reserved 0033h reserved 0034h - wdtcr1 0035h - wdtcr2 0036h tbtcr 0037h eintcr 0038h syscr1 0039h syscr2 003ah eirl 003bh eirh 003ch ill 003dh ilh 003eh intsel 003fh psw address read write
page 47 TMP86P807MG 5. i/o ports the TMP86P807MG have 4 parallel input/output ports as follows. each output port contains a latch, which holds the output data. all input ports do not have latches, so the external input data should be externally held until the input data is read from outside or reading should be performed several timer before processing. figure 5-1 shows input/output timing examples. external data is read from an i/o port in the s1 state of the read cycle during execution of the read instruction. this timing cannot be recognized from outside, so that transient input such as chattering must be processed by the pro- gram. output data changes in the s2 state of the write cycle du ring execution of the instruct ion which writes to an i/o port. note: the positions of the read and write c ycles may vary, depending on the instruction. figure 5-1 input/output timing (example) primary function secondary functions port p0 8-bit i/o port external interrupt input, timer/counter input/output, serial interface input/output port p1 3-bit i/o port external interrupt input and divider output port p2 3-bit i/o port external interrupt input and stop mode release signal input port p3 8-bit i/o port analog input, stop mode release signal input and timer/counter input/output 

  
 
     
  

  

  
   ! "    ! "    ! " 

  
# 
 #      
  

  
$
 
   ! "    ! "    ! "   %&  # %& # '
(
page 48 5. i/o ports TMP86P807MG 5.1 p0 (p07 to p00) port (high current) the p0 port is an 8-bit inpu t/output port shared with exte rnal interrupt input, sei seri al interface input/output, and uart and 16-bit timer counter input/output. when using this port as an input port or for external interrupt input, sei serial interface input/output, or uart input/output, set the output latch to 1. when using this port as an output port, the output latch data (p0dr) is output to the p0 port. when reset, the output latch (p0dr) and the push-pull co ntrol register (p0outcr) ar e initialized to 1 and 0, respectively. the p0 port allows its output circuit to be selected between n-channel open-drain output or push-pull output by the p0outcr register. when using this port as an input port, set the p0outcr register's corresponding bit to 0 after setting the p0dr to 1. the p0 port has independent data input registers. to inspect the output latch status, read the p0dr register. to inspect the pin status, r ead the p0prd register. figure 5-2 p0 port p0dr (0000h) r/w 76543210 p07 tc1 int4 p06 int3 ppg p05 ss p04 miso p03 mosi p02 sclk p01 rxd p00 txd (initial value: 1111 1111) p0prd (000ch) read only 76543210 p07 p06 p05 p04 p03 p02 p01 p00 p0outcr (000bh) p0outcr controls p0 port input/output (specified bitwise) 0: nch open-drain output 1: push-pull output r/w     
             


 
    
 
 
      
page 49 TMP86P807MG 5.2 p1 (p12 to p10) port the p1 port is a 3-bit input/output port that can be specified for input or output bitwise. the p1 port input/output control register (p1cr) is used to specify this port for input or output. when reset, the p1cr register is initialized to 0, with the p1 port set for input mode. the p1 port output latch is initialized to 0. the p1 port is shared with external interrupt input and divider output. when using the p1 port as function pin, set its input pins for input mode. for the output pins, first set their output latches to 1 before setting the pins for output mode. note that the p11 pin is an external interrupt input. (when used as an output port, its interrupt latch is set at the ris- ing or falling edge.) the p10 pin can be used as an input/output port or an external interrupt input by selecting its function with the external interrupt control register (int0e n). when reset, the p10 pin is chosen to be an input port. figure 5-3 p1 port p1dr (0001h) r/w 76543210 p12 dvo p11 int1 p10 int0 (initial value: **** *0000) p1cr (0009h) 76543210 (initial value: **** *000) p1cr controls p1 port input/output (specified bitwise) 0: input mode 1: output mode r/w output latch p1cri data output (p1dr) output latch p1cri input control output stop outen data input (p1dr) control input p1i note: i = 2 to 0 d q d q
page 50 5. i/o ports TMP86P807MG 5.3 p2 (p22 to p20) port the p2 port is a 3-bit input/output port shared with extern al interrupt input, stop canceling signal input, and low- frequency resonator connecting pin. when using this port as an input port or function pin, set the output latch to 1. the output latch is initialized to 1 when reset. when op erating in dual-clock mode, co nnect a low-frequency resona- tor (32.768 khz) to the p21 (xtin) and p22 (xtout) pi ns. when operating in single-clock mode, the p21 and p22 pins can be used as ordinary input/output ports. we recommend using the p20 pin for external interrupt input or stop canceling signal input or as an input port. (when used as an output port, the interrupt latch is set by a falling edge.) the p2 port has independent data input registers. to inspect the output latch status, read the p2dr register. to inspect the pin status, read the p2prd register. when the p2dr or p2prd r ead instruction is executed for the p2 port, the values read from b its 7 to 3 are indeterminate. figure 5-4 p2 port note: the p20 pin is shared with the stop pin, so that when in stop mode, its output goes to a high-z state regardless of the outen status. p2dr (0002h) r/w 76543210 p22 xtout p21 xtin p20 int5 stop (initial value: **** *111) p2prd (000dh) read only 76543210 p22 p21 p20       
    
      
   
 
    
  
                  ! " #" $ % $ % $ %
page 51 TMP86P807MG 5.4 p3 (p37 to p30) port the p3 port is an 8-bit input/output port that can be specifi ed for input or output bitwise, and is shared with analog input, key-on wakeup input, and 8-bit timer counter input/o utput. the p3 port input/output control register (p3cr) and adccr1 are used to specify this port for input or output. when reset, the p3cr register and p3dr are cleared to 0, while ainds is set to 1, so that p37 to p30 function as input port. when using the p3 port as an input port, set ainds = 1 while at the same time setting the p3cr register to 0. when using the p3 port for analog in put, set ainds = 0 and the pins sel ected with adccr1 are set for analog input no matter what values are set in the p3dr and p3cr. when using the p3 port as an output port, set the p3cr to 1 and the pin associated with that bit is set for output mode, so that p3dr (output latch data) is output from that pin. when an input instruction is executed for the p3 port while using the ad converter, the pins selected for analog input read in the p3dr value into the internal circuit and th ose not selected for analog in put read in a 1 or 0 accord- ing to the logic level on each pin. even when an output instruct ion is executed, no latch data are forwarded to the pins selected for analog input. any pins of the p3 port which are not used for analog input can be used as input/output ports. during ad conver- sion, however, avoid executing output instru ctions on these ports, because this is necessary to maintain the accuracy of conversion. also, during ad conversion, take care not to enter a rapi dly changing signal to any port adjacent to analog input. figure 5-5 p3 port output latch output latch data input (p3dr) analog input key-on wakeup data output (p3dr) stop stopnen outen ainds sain p3cri p3cri input p3i note 1: i = 7 to 2 note 2: n = 7 to 4 note 3: functions enclosed  with broken lines do not apply to  p32 and p33. d q d q output latch output latch data input (p3dr) data output (p3dr) control input a) equivalent circuit of p32 to p37 b) equivalent circuit of p30, p31 control output stop outen p3cri p3cri input p3i note: i = 1 to 0 d q d q
page 52 5. i/o ports TMP86P807MG note 1: when using the port for key-on wakeup input (stop2 to 5), set the p3cr register's corresponding bits to 0. note 2: p30 and p31 are hysteresis inputs. p34 to p 37 become hysteresis inputs only during key-on wakeup. note 3: input status on ports set for input mode are read in into the internal circuit. therefore, when using the ports in a mix ture of input and output modes, the contents of the output latches for the ports that are set for input mode may be rewritten by execution of bit mani pulating instructions. p3dr (0003h) r/w 76543210 p37 ain5 stop5 p36 ain4 stop4 p35 ain3 stop3 p34 ain2 stop2 p33 ain1 p32 ain0 p31 tc4 pdo4 pwm4 ppg4 p30 tc3 pdo3 pwm3 (initial value: 0000 0000) p3cr (000ah) 76543210 (initial value: 0000 0000) p3cr controls p3 port output (speci- fied bitwise) 0: input mode 1: output mode r/w analog input mode input mode output mode p3cr 0 1 ainds 0 1 p3dr 0 *
page 53 TMP86P807MG 6. time base timer (tbt) the time base timer generates time base for key scanning, dynamic displaying, etc. it also provides a time base timer interrupt (inttbt). 6.1 time base timer 6.1.1 configuration figure 6-1 time base timer configuration 6.1.2 control time base timer is controlled by time base timer control register (tbtcr). note 1: fc; high-frequency clock [hz], fs ; low-frequency clock [hz], *; don't care time base timer control register 7 6543210 tbtcr (0036h) (dvoen) (dvock) (dv7ck) tbten tbtck (initial value: 0000 0000) tbten time base timer enable / disable 0: disable 1: enable tbtck time base timer interrupt frequency select : [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 23 fs/2 15 fs/2 15 001 fc/2 21 fs/2 13 fs/2 13 010 fc/2 16 fs/2 8 ? 011 fc/2 14 fs/2 6 ? 100 fc/2 13 fs/2 5 ? 101 fc/2 12 fs/2 4 ? 110 fc/2 11 fs/2 3 ? 111 fc/2 9 fs/2 ? fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 16 or fs/2 8 fc/2 14 or fs/2 6 fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 9 or fs/2 tbtcr tbten tbtck 3 mpx source clock falling edge detector time base timer control register inttbt interrupt request idle0, sleep0 release request
page 54 6. time base timer (tbt) 6.1 time base timer TMP86P807MG note 2: the interrupt frequency (tbtck) must be selected with t he time base timer disabled (tbten="0"). (the interrupt fre- quency must not be changed with the disable from the enable state.) both frequency selection and enabling can be per- formed simultaneously. 6.1.3 function an inttbt ( time base timer interrupt ) is generated on the first falling edge of source clock ( the divider output of the timing generator which is selected by tb tck. ) after time base timer has been enabled. the divider is not cleared by the progra m; therefore, only the first interrupt may be generated ahead of the set interrupt period ( figure 6-2 ). figure 6-2 time base timer interrupt example :set the time base timer frequency to fc/2 16 [hz] and enable an inttbt interrupt. ld (tbtcr) , 00000010b ; tbtck 010 ld (tbtcr) , 00001010b ; tbten 1 di ; imf 0 set (eirl) . 6 table 6-1 time base timer interrupt frequency ( example : fc = 16.0 mhz, fs = 32.768 khz ) tbtck time base timer interrupt frequency [hz] normal1/2, idle1/2 mode normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 000 1.91 1 1 001 7.63 4 4 010 244.14 128 ? 011 976.56 512 ? 100 1953.13 1024 ? 101 3906.25 2048 ? 110 7812.5 4096 ? 111 31250 16384 ? source clock enable tbt interrupt period tbtcr inttbt
page 55 TMP86P807MG 6.2 divider output ( dvo ) approximately 50% duty pulse can be output using the divider output circuit, which is useful for piezoelectric buzzer drive. divider output is from dvo pin. 6.2.1 configuration figure 6-3 divider output 6.2.2 control the divider output is controlled by the time base timer control register. note: selection of divider output frequency (dvock) must be made whil e divider output is disabled (dvoen="0"). also, in other words, when changing the state of the divider output frequen cy from enabled (dvoen="1") to disable(dvoen="0"), do not change the setting of the divider output frequency. time base timer control register 7654 321 0 tbtcr (0036h) dvoen dvock (dv7ck) (tbten) (tbtck) (initial value: 0000 0000) dvoen divider output enable / disable 0: disable 1: enable r/w dvock divider output ( dvo ) frequency selection: [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 13 fs/2 5 fs/2 5 01 fc/2 12 fs/2 4 fs/2 4 10 fc/2 11 fs/2 3 fs/2 3 11 fc/2 10 fs/2 2 fs/2 2 tbtcr output latch port output latch mpx dvoen tbtcr dvo pin output dvock divider output control register (a) configuration (b) timing chart data output 2 a b c y d s d q dvo pin fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 10 or fs/2 2
page 56 6. time base timer (tbt) 6.2 divider output (dvo) TMP86P807MG example :1.95 khz pulse output (fc = 16.0 mhz) ld (tbtcr) , 00000000b ; dvock "00" ld (tbtcr) , 10000000b ; dvoen "1" table 6-2 divider output frequency ( exam ple : fc = 16.0 mhz, fs = 32.768 khz ) dvock divider output frequency [hz] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 00 1.953 k 1.024 k 1.024 k 01 3.906 k 2.048 k 2.048 k 10 7.813 k 4.096 k 4.096 k 11 15.625 k 8.192 k 8.192 k
page 57 TMP86P807MG 7. watchdog timer (wdt) the watchdog timer is a fail-safe system to detect rapidl y the cpu malfunctions such as endless loops due to spu- rious noises or the deadlock conditions, and return the cpu to a sy stem recovery routine. the watchdog timer signal for detecting malfunctions can be programmed only once as ?reset request? or ?inter- rupt request?. upon the reset release, this signal is initialized to ?reset request?. when the watchdog timer is not used to detect malfunctions, it can be used as the timer to provide a periodic inter- rupt. note: care must be taken in system des ign since the watchdog timer functions are not be operated completely due to effect of disturbing noise. 7.1 watchdog timer configuration figure 7-1 watchdog timer configuration 0034 h overflow wdt output internal reset binary counters wdtout writing clear code writing disable code wdten wdtt 2 0035 h watchdog timer control registers wdtcr1 wdtcr2 intwdt interrupt request interrupt request reset request reset release clock clear 1 2 controller q sr s r q selector fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 19 or fs/2 11 fc/2 17 or fs/2 9
page 58 7. watchdog timer (wdt) 7.2 watchdog timer control TMP86P807MG 7.2 watchdog timer control the watchdog timer is controlled by the watchdog timer control registers (wdtcr1 and wdtcr2). the watch- dog timer is automatically enabled after the reset release. 7.2.1 malfunction detection me thods using the watchdog timer the cpu malfunction is detected, as shown below. 1. set the detection time, select the output, and clear the binary counter. 2. clear the binary counter repeatedly within the specified detection time. if the cpu malfunctions such as en dless loops or the deadlock condition s occur for some reason, the watch- dog timer output is activated by the binary-counter overflow unless the binary counters are cleared. when wdtcr1 is set to ?1? at this time, the reset request is generated and then internal hardware is initialized. when wdtcr1 is set to ?0?, a watchdog timer interrupt (intwdt) is generated. the watchdog timer temporarily stops counting in th e stop mode including the warm-up or idle/sleep mode, and automatically restarts (continues counting) when the stop/idle/sleep mode is inactivated. note:the watchdog timer consists of an internal divider and a two-stage binary counter. when the clear code 4eh is written, only the binary counter is cleared, but not the internal divider . the minimum binary-counter overflow time, that depends on the timing at which the clear code (4eh) is written to the wdtcr2 register, may be 3/ 4 of the time set in wdtcr1. therefore, writ e the clear code using a cycle shorter than 3/4 of the time set to wdtcr1. example :setting the watchdog timer detection time to 2 21 /fc [s], and resetting the cpu malfunction detection ld (wdtcr2), 4eh : clears the binary counters. ld (wdtcr1), 00001101b : wdtt 10, wdtout 1 ld (wdtcr2), 4eh : clears the binary counters (always clears immediately before and after changing wdtt). within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters. within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters.
page 59 TMP86P807MG note 1: after clearing wdtout to ?0?, the program cannot set it to ?1?. note 2: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 3: wdtcr1 is a write-only register and must not be used with any of read-modify-write instructions. if wdtcr1 is read, a don?t care is read. note 4: to activate the stop mode, disable the watchdog timer or clear the counter immediately before entering the stop mode. after clearing the counter, clear the counter again immediately after the stop mode is inactivated. note 5: to clear wdten, set the register in accordance wi th the procedures shown in ?7.2.3 watchdog timer disable?. note 1: the disable code is valid only when wdtcr1 = 0. note 2: *: don?t care note 3: the binary counter of the watchdog timer must not be cleared by the interrupt task. note 4: write the clear code 4eh using a cycle shor ter than 3/4 of the time set in wdtcr1. 7.2.2 watchdog timer enable setting wdtcr1 to ?1? enables the watc hdog timer. since wdtcr1 is initialized to ?1? during reset, the watchdog timer is enabled automatically after the reset release. watchdog timer control register 1 wdtcr1 (0034h) 76543210 (atas) (atout) wdten wdtt wdtout (initial value: **11 1001) wdten watchdog timer enable/disable 0: disable (writing the disable code to wdtcr2 is required.) 1: enable write only wdtt watchdog timer detection time [s] normal1/2 mode slow1/2 mode write only dv7ck = 0 dv7ck = 1 00 2 25 /fc 2 17 /fs 2 17 /fs 01 2 23 /fc 2 15 /fs 2 15 fs 10 2 21 fc 2 13 /fs 2 13 fs 11 2 19 /fc 2 11 /fs 2 11 /fs wdtout watchdog timer output select 0: interrupt request 1: reset request write only watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code 4eh: clear the watchdog timer binary counter (clear code) b1h: disable the watchdog timer (disable code) d2h: enable assigning address trap area others: invalid write only
page 60 7. watchdog timer (wdt) 7.2 watchdog timer control TMP86P807MG 7.2.3 watchdog timer disable to disable the watchdog timer, set the register in accordance with the fo llowing procedures . setting the reg- ister in other procedures causes a malfunction of the microcontroller. 1. set the interrupt master flag (imf) to ?0?. 2. set wdtcr2 to the clear code (4eh). 3. set wdtcr1 to ?0?. 4. set wdtcr2 to the disable code (b1h). note:while the watchdog timer is disabled, the binary counters of the watchdog timer are cleared. 7.2.4 watchdog time r interrupt (intwdt) when wdtcr1 is cleared to ?0?, a watchdog timer interrupt request (intwdt) is generated by the binary-counter overflow. a watchdog timer interrupt is the non-maskable interr upt which can be accepted regardless of the interrupt master flag (imf). when a watchdog timer interrupt is generated while the other interrupt including a watchdog timer interrupt is already accepted, the new watchdog timer interrupt is processed immediately and the previous interrupt is held pending. therefore, if watchdog timer interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate a watchdog timer interrupt, set the stack pointer before setting wdtcr1. example :disabling the watchdog timer di : imf 0 ld (wdtcr2), 04eh : clears the binary counter ldw (wdtcr1), 0b101h : wdten 0, wdtcr2 disable code table 7-1 watchdog timer detection time (example: fc = 16.0 mhz, fs = 32.768 khz) wdtt watchdog timer detection time[s] normal1/2 mode slow mode dv7ck = 0 dv7ck = 1 00 2.097 4 4 01 524.288 m 1 1 10 131.072 m 250 m 250 m 11 32.768 m 62.5 m 62.5 m example :setting watchdog timer interrupt ld sp, 013fh : sets the stack pointer ld (wdtcr1), 00001000b : wdtout 0
page 61 TMP86P807MG 7.2.5 watchdog timer reset when a binary-counter overflow occurs while wdt cr1 is set to ?1?, a watchdog timer reset request is generated. when a watchdog timer reset request is generated, the internal hardware is reset. the reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 mhz). note:when a watchdog timer reset is generated in the sl ow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors. figure 7-2 watchdog timer interrupt clock binary counter overflow intwdt interrupt request (wdtcr1= "0") 2 17 /fc 2 19 /fc [s] (wdtt=11) write 4e h to wdtcr2 1 2 30 1 2 3 0 internal reset (wdtcr1= "1") a reset occurs
page 62 7. watchdog timer (wdt) 7.3 address trap TMP86P807MG 7.3 address trap the watchdog timer control register 1 and 2 share the a ddresses with the control regi sters to generate address traps. 7.3.1 selection of address tr ap in internal ram (atas) wdtcr1 specifies whether or not to generate address traps in the inte rnal ram area. to execute an instruction in the internal ram area, clear wdtcr1 to ?0?. to enable the wdtcr1 set- ting, set wdtcr1 and then write d2h to wdtcr2. executing an instruction in the sfr area generates an address trap unc onditionally regardless of the setting in wdtcr1. 7.3.2 selection of operati on at address trap (atout) when an address trap is generated, either the inte rrupt request or the reset request can be selected by wdtcr1. 7.3.3 address trap interrupt (intatrap) while wdtcr1 is ?0?, if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on -chip ram (while wdtcr1 is ?1?) or the sfr area, address trap interrupt (intatrap) will be generated. an address trap interrupt is a non-maskable interrupt which can be accepted regardless of the interrupt mas- ter flag (imf). when an address trap interrupt is generated while the other interrupt including an address trap interrupt is already accepted, the new address trap is processed immediately and the previous interrupt is held pending. therefore, if address trap interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate address trap interrupts, set the stack pointer beforehand. watchdog timer control register 1 wdtcr1 (0034h) 7654 3 21 0 atas atout (wdten) (wdtt) (wdtout) (initial value: **11 1001) atas select address trap generation in the internal ram area 0: generate no address trap 1: generate address traps (after setting atas to ?1?, writing the control code d2h to wdtcr2 is required) write only atout select operation at address trap 0: interrupt request 1: reset request watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code and address trap area control code d2h: enable address trap area selection (atrap control code) 4eh: clear the watchdog timer binary counter (wdt clear code) b1h: disable the watchdog timer (wdt disable code) others: invalid write only
page 63 TMP86P807MG 7.3.4 address trap reset while wdtcr1 is ?1?, if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on -chip ram (while wdtcr1 is ?1?) or the sfr area, address trap reset will be generated. when an address trap reset request is generated, the in ternal hardware is reset. the reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 mhz). note:when an address trap reset is generated in the slow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors.
page 64 7. watchdog timer (wdt) 7.3 address trap TMP86P807MG
page 65 TMP86P807MG 8. 16-bit timercounter 1 (tc1) 8.1 configuration figure 8-1 timercounter 1 (tc1) :::? pin tc1 :w:?::? mett1 start capture clear source clock ppg output mode write to tc1cr 16-bit up-counter clear tc1drb selector tc1dra tc1cr tc1 control register match inttc1 interript tff1 acap1 tc1ck window mode set toggle q 2 toggle set clear q y a d b c s b a y s tc1s clear mppg1 ppg output mode internal reset s enable mcap1 s y a b tc1s 2 set clear command start decoder external trigger start edge detector note: function i/o may not operate depending on i/o port setting. for more details, see the chapter "i/o port". port (note) q pulse width measurement mode falling rising trigger external cmp 16-bit timer register a, b pulse width measurement mode port (note) fc/2 11, fs/2 3 fc/2 7 fc/2 3
page 66 8. 16-bit timercounter 1 (tc1) 8.2 timercounter control TMP86P807MG 8.2 timercounter control the timercounter 1 is controlled by the timercounter 1 control register (tc1cr) and two 16-bit timer registers (tc1dra and tc1drb). note 1: fc: high-frequency clock [hz], fs: low-frequency clock [hz] note 2: the timer register consists of two shift registers. a va lue set in the timer register becomes valid at the rising edge o f the first source clock pulse that occurs after the upper byte (t c1drah and tc1drbh) is written. therefore, write the lower byte and the upper byte in this order (it is recommended to write the register with a 16-bit acce ss instruction). writing only the lower byte (tc1dral and tc1drbl) does not enable the setting of the timer register. note 3: to set the mode, source clock, ppg output control and time r f/f control, write to tc1cr during tc1s=00. set the timer f/ f1 control until the first timer start after setting the ppg mode. timer register 1514131211109876543210 tc1dra (0011h, 0010h) tc1drah (0011h) tc1dral (0010h) (initial value: 1111 1111 1111 1111) read/write tc1drb (0013h, 0012h) tc1drbh (0013h) tc1drbl (0012h) (initial value: 1111 1111 1111 1111) read/write (write e nabled only in the ppg output mode) timercounter 1 control register tc1cr (0014h) 76543210 tff1 acap1 mcap1 mett1 mppg1 tc1s tc1ck tc1m read/write (initial value: 0000 0000) tff1 timer f/f1 control 0: clear 1: set r/w acap1 auto capture control 0:auto-capture disable 1:auto-capture enable r/w mcap1 pulse width measure- ment mode control 0:double edge capture 1:single edge capture mett1 external trigger timer mode control 0:trigger start 1:trigger start and stop mppg1 ppg output control 0:continuous pulse generation 1:one-shot tc1s tc1 start control timer extrig- ger event win- dow pulse ppg r/w 00: stop and counter clear oooooo 01: command start o????o 10: rising edge start (ex-trigger/pulse/ppg) rising edge count (event) positive logic count (window) ? ooooo 11: falling edge start (ex-trigger/pulse/ppg) falling edge count (event) negative logic count (window) ? ooooo tc1ck tc1 source clock select [hz] normal1/2, idle1/2 mode divider slow, sleep mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 11 fs/2 3 dv9 fs/2 3 01 fc/2 7 fc/2 7 dv5 ? 10 fc/2 3 fc/2 3 dv1 ? 11 external clock (tc1 pin input) tc1m tc1 operating mode select 00: timer/external trigger timer/event counter mode 01: window mode 10: pulse width measurement mode 11: ppg (programmable pulse generate) output mode r/w
page 67 TMP86P807MG note 4: auto-capture can be used only in t he timer, event counter, and window modes. note 5: to set the timer registers, the following relationship must be satisfied. tc1dra > tc1drb > 1 (ppg output mode), tc1dra > 1 (other modes) note 6: set tff1 to ?0? in the mode except ppg output mode. note 7: set tc1drb after setting tc1m to the ppg output mode. note 8: when the stop mode is entered, the start control (tc1s) is cleared to ?00? automatically, and the timer stops. after the stop mode is exited, set the tc1s to use the timer counter again. note 9: use the auto-capture function in the operative condition of tc1. a captured value may not be fixed if it's read after th e execution of the timer stop or auto-capture disable. read the capture value in a capture enabled condition. note 10:since the up-counter value is captured into tc1drb by the source clock of up-counter after setting tc1cr to "1". therefore, to read the captured value, wait at least one cycle of the internal source clock before reading tc1drb for the first time.
page 68 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG 8.3 function timercounter 1 has six types of operating modes: timer, external trigger timer, event counter, window, pulse width measurement, programmable pulse generator output modes. 8.3.1 timer mode in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register 1a (tc1dra) value is detected, an inttc1 interr upt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counting. setting tc1cr to ?1? captures the up-counter value into the timer reg- ister 1b (tc1drb) with the auto-capture function. use the auto-capture function in the operative conditio n of tc1. a cap- tured value may not be fixed if it's read after the execution of the timer stop or auto-capture disa ble. read the capture value in a capture enabled condition. since the up-counter value is captured into tc1drb by the source clock of up-counter after setting tc1cr to "1". therefore, to read the captured value, wait at leas t one cycle of the internal source clock before reading tc1drb for the first time. note: since the up-counter value is captured into tc1drb by the source clock of up-counter after setting tc1cr to "1". therefore, to read the captured value, wait at least one cycle of the internal source clock before reading tc1drb for the first time. table 8-1 internal source clock for timercounter 1 (example: fc = 16 mhz, fs = 32.768 khz) tc1ck normal1/2, idle1/2 mode slow, sleep mode dv7ck = 0 dv7ck = 1 resolution [ s] maximum time setting [s] resolution [ s] maximum time setting [s] resolution [ s] maximum time set- ting [s] 00 128 8.39 244.14 16.0 244.14 16.0 01 8.0 0.524 8.0 0.524 ? ? 10 0.5 32.77 m 0.5 32.77 m ? ? example 1 :setting the timer mode with source clock fc/2 11 [hz] and generating an interrupt 1 second later (fc = 16 mhz, tbtcr = ?0?) ldw (tc1dra), 1e84h ; sets the timer register (1 s 2 11 /fc = 1e84h) di ; imf = ?0? set (eirl). 7 ; enables inttc1 ei ; imf = ?1? ld (tc1cr), 00000000b ; selects the source clock and mode ld (tc1cr), 00010000b ; starts tc1 example 2 :auto-capture ld (tc1cr), 01010000b ; acap1 1   ld wa, (tc1drb) ; reads the capture value
page 69 TMP86P807MG figure 8-2 timer mode timing chart match detect acap1 tc1drb tc1dra inttc1 interruput request source clock counter source clock counter ? (a) timer mode (b) auto-capture ? 7 6 345 0 timer start 12 3 2 1 4 0 counter clear capture n + 1 n n n m + 2 m + 1 m m capture m + 2 m + 1 n + 1 n m ? 1 m ? 1 m ? 2 n ? 1 n ? 1 n ? 1
page 70 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG 8.3.2 external trigger timer mode in the external trigger timer mode, the up-counter starts counting by the input pulse triggering of the tc1 pin, and counts up at the edge of the internal clock. for the trigger edge used to start counting, either the rising or falling edge is defined in tc1cr. ? when tc1cr is set to ?1? (trigger st art and stop) when a match between the up-counter and the tc1dra value is detected after the timer starts, the up-counter is cleared and halted and an inttc1 interrupt request is generated. if the edge opposite to trigger edge is detected before detecting a match between the up-counter and the tc1dra, the up-counter is cleared and ha lted without generating an interrupt request. therefore, this mode can be used to det ect exceeding the specified pulse by interrupt. after being halted, the up-count er restarts counting when th e trigger edge is detected. ? when tc1cr is set to ?0? (trigger start) when a match between the up-counter and the tc1dra value is detected after the timer starts, the up-counter is cleared and halted and an inttc1 interrupt request is generated. the edge opposite to the trigger edge has no effect in count up. the trigger edge for the next count- ing is ignored if detecting it before detectin g a match between the up-counter and the tc1dra. since the tc1 pin input has the noise rejection, pulses of 4/fc [s] or less are rejected as noise. a pulse width of 12/fc [s] or more is required to ensure edge detectio n. the rejection circuit is turned off in the slow1/2 or sleep1/2 mode, but a pulse width of one machine cycl e or more is required. example 1 :generating an interrupt 1 ms after the rising edge of the input pulse to the tc1 pin (fc =16 mhz) ldw (tc1dra), 007dh ; 1ms 2 7 /fc = 7dh di ; imf = ?0? set (eirl). 7 ; enables inttc1 interrupt ei ; imf = ?1? ld (tc1cr), 00000100b ; selects the source clock and mode ld (tc1cr), 00100100b ; starts tc1 external trigger, mett1 = 0 example 2 :generating an interrupt when the low-level pulse with 4 ms or more width is input to the tc1 pin (fc =16 mhz) ldw (tc1dra), 01f4h ; 4 ms 2 7 /fc = 1f4h di ; imf = ?0? set (eirl). 7 ; enables inttc1 interrupt ei ; imf = ?1? ld (tc1cr), 00000100b ; selects the source clock and mode ld (tc1cr), 01110100b ; starts tc1 external trigger, mett1 = 1
page 71 TMP86P807MG figure 8-3 external tri gger timer mode timing chart inttc1 interrupt request source clock up-counter tc1dra tc1 pin input inttc1 interrupt request source clock up-counter tc1dra tc1 pin input 0 at the rising edge (tc1s = 10) at the rising edge (tc1s = 10) (a) trigger start (mett1 = 0) count start match detect count start 0 1 2 3 4 2 3 n (b) trigger start and stop (mett1 = 1) count start count start 0 1 2 3 m 0 n n 0 count clear note: m < n count clear 1 2 3 1 n m ? 1 n ? 1 match detect count clear
page 72 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG 8.3.3 event counter mode in the event counter mode, the up-counter counts up at the edge of the input pulse to the tc1 pin. either the rising or falling edge of the input pulse is se lected as the count up edge in tc1cr. when a match between the up-counter and the tc1dra va lue is detected, an inttc1 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counting at each edge of the input pulse to the tc1 pin. since a match between the up-counter and the value set to tc1dra is detected at the edge opposite to the selected edge, an inttc1 interrupt request is generated after a match of the value at the edge opposite to the selected edge. two or more machine cycles are required for th e low-or high-level pulse input to the tc1 pin. setting tc1cr to ?1? captures the up-counter value into tc1drb with the auto capture function. use the auto-capture function in the operative condition of tc1. a captured value may not be fixed if it's read after the execution of the timer stop or auto-capture disable. read the captu re value in a captu re enabled condi- tion. since the up-counter value is captured into tc1drb by the source clock of up-counter after setting tc1cr to "1". theref ore, to read the captured value, wait at least one cycle of the internal source clock before reading tc1drb for the first time. figure 8-4 event c ounter mode timing chart table 8-2 input pulse width to tc1 pin minimum pulse width [s] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode high-going 2 3 /fc 2 3 /fs low-going 2 3 /fc 2 3 /fs at the rising edge (tc1s = 10) inttc1 interrput request tc1 pin input up-counter tc1dra ? 2 1 0 n timer start 2 1 0 n match detect counter clear n ? 1
page 73 TMP86P807MG 8.3.4 window mode in the window mode, the up-counter counts up at the rising edge of the pulse that is logical anded product of the input pulse to the tc1 pin (window pulse) and the internal source clock. eith er the positive logic (count up during high-going pulse) or negative logic (count up during low-going pulse) can be selected. when a match between the up-counter and the tc1dra va lue is detected, an inttc1 interrupt is generated and the up-counter is cleared. define the window pulse to the frequency which is sufficiently lower than the internal source clock pro- grammed with tc1cr. figure 8-5 window mode timing chart match detect tc1dra inttc1 interrput request interrput request internal clock counter tc1dra tc1 pin input internal clock counter tc1 pin input inttc1 (a) positive logic (tc1s = 10) (b) negative logic (tc1s = 11) ? ? match detect 1 0 7 47 5 46 31 2 1 0 7 5 3 6 2 0 2 3 counter clear timer start 890 1 9 timer start counter clear count start count stop count start count start count stop count start
page 74 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG 8.3.5 pulse width measurement mode in the pulse width measurement mode, the up-counter starts counting by the input pulse triggering of the tc1 pin, and counts up at the edge of the internal clock. either the rising or falling edge of the internal clock is selected as the trigger edge in tc1cr< tc1s>. either the single- or double-e dge capture is selected as the trig- ger edge in tc1cr. ? when tc1cr is set to ?1? (single-edge capture) either high- or low-level input pulse width can be measured. to measure the high-level input pulse width, set the rising edge to tc1cr. to measure the low-level input pulse width, set the falling edge to tc1cr. when detecting the edge opposite to the trigger ed ge used to start countin g after the timer starts, the up-counter captures the up-counter value in to tc1drb and generates an inttc1 interrupt request. the up-counter is cleared at this time, a nd then restarts counting wh en detecting the trigger edge used to start counting. ? when tc1cr is set to ?0? (double-edge capture) the cycle starting with either the high- or low-going input pulse can be measured. to measure the cycle starting with the high-going pulse, set the ri sing edge to tc1cr. to measure the cycle starting with the low-going pulse, set the falling edge to tc1cr. when detecting the edge opposite to the trigger ed ge used to start countin g after the timer starts, the up-counter captures the up-counter value in to tc1drb and generates an inttc1 interrupt request. the up-counter continues counting up, a nd captures the up-counter value into tc1drb and generates an inttc1 interrupt request when detecting the trigger edge used to start counting. the up-counter is cleared at this time, and then continues counting. note 1: the captured value must be read from tc1drb until the next trigger edge is detected. if not read, the cap- tured value becomes a don?t care. it is recommended to us e a 16-bit access instruction to read the captured value from tc1drb. note 2: for the single-edge capture, the counter after capt uring the value stops at ?1? until detecting the next edge. therefore, the second captured value is ?1? larger than the captured value i mmediately after counting starts. note 3: the first captured value after the timer starts may be read incorrectively, therefore, ignore the first captured value.
page 75 TMP86P807MG example :duty measurem ent (resolution fc/2 7 [hz]) clr (inttc1sw). 0 ; inttc1 serv ice switch initial setting address set to convert inttc1sw at each inttc1 ld (tc1cr), 00000110b ; sets the tc1 mode and source clock di ; imf = ?0? set (eirl). 7 ; enables inttc1 ei ; imf = ?1? ld (tc1cr), 00100110b ; starts tc1 with an external trigger at mcap1 = 0 : pinttc1: cpl (inttc1sw). 0 ; inttc1 interrupt, inverts and tests inttc1 service switch jrs f, sinttc1 ld a, (tc1drbl) ; reads tc1drb (high-level pulse width) ld w,(tc1drbh) ld (hpulse), wa ; stores high-level pulse width in ram reti sinttc1: ld a, (tc1drbl) ; reads tc1drb (cycle) ld w,(tc1drbh) ld (width), wa ; stores cycle in ram : reti ; duty calculation : vinttc1: dw pinttc1 ; inttc1 interrupt vector width hpulse tc1 pin inttc1 interrupt request inttc1sw
page 76 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG figure 8-6 pulse wi dth measurement mode tc1drb inttc1 interrupt request interrupt request tc1 pin input counter internal clock (mcap1 = "1") 23 n count start count start trigger (tc1s = "10") 1 3 2 1 4 0 n 0 capture n - 1 tc1drb inttc1 tc1 pin input counter internal clock (mcap1 = "0") 12 n count start count start (tc1s = "10") 3 2 1 4 0 n capture capture n + 1 m - 2 n + 3 n + 2 n + 1 m - 1 m0 m [application] high-or low-level pulse width measurement [application] (1) cycle/frequency measurement (2) duty measurement (a) single-edge capture (b) double-edge capture
page 77 TMP86P807MG 8.3.6 programmable pulse generate (ppg) output mode in the programmable pulse generation (ppg) mode, an arbitrary duty pulse is generated by counting per- formed in the internal clock. to start the timer, tc1c r specifies either the edge of the input pulse to the tc1 pin or the command start. tc1cr specifies whether a duty pulse is produced continuously or not (one-shot pulse). ? when tc1cr is set to ?0? (continuous pulse generation) when a match between the up-counter and the tc1drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc1 interrupt request is generated. the up-counter contin- ues counting. when a match between the up-counter and the tc1dra value is detected, the level of the ppg pin is inverted and an inttc1 interrupt requ est is generated. the up-counter is cleared at this time, and then continues counting and pulse generation. when tc1s is cleared to ?00? during ppg output, the ppg pin retains the level immediately before the counter stops. ? when tc1cr is set to ?1? (one-shot pulse generation) when a match between the up-counter and the tc1drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc1 interrupt request is generated. the up-counter contin- ues counting. when a match between the up-counter and the tc1dra value is detected, the level of the ppg pin is inverted and an inttc1 interrupt re quest is generated. tc1cr is cleared to ?00? automatically at this time, and the timer stops. the pulse generated by ppg retains the same level as that when the timer stops. since the output level of the ppg pin can be set with tc1cr when the timer starts, a positive or neg- ative pulse can be generated. since the inverted level of the timer f/f1 output level is output to the ppg pin, specify tc1cr to ?0? to set the high level to the ppg pin, and ?1? to set the low level to the ppg pin. upon reset, the timer f/f1 is initialized to ?0?. note 1: to change tc1dra or tc1drb during a run of the ti mer, set a value sufficiently larger than the count value of the counter. setting a value smaller than the count value of the counter during a run of the timer may generate a pulse different from that specified. note 2: do not change tc1cr during a run of the ti mer. tc1cr can be set correctly only at initial- ization (after reset). when the timer stops during pp g, tc1cr can not be set correctly from this point onward if the ppg output has the level which is inverted of the level when the timer starts. (setting tc1cr specifies the timer f/f1 to the level inverted of the programmed value.) therefore, the timer f/f1 needs to be initialized to ensure an arbitrar y level of the ppg output. to initialize the timer f/f1, change tc1cr to the timer mode (it is not required to start the timer mode), and then set the ppg mode. set tc1cr at this time. note 3: in the ppg mode, the follow ing relationship must be satisfied. tc1dra > tc1drb note 4: set tc1drb after changing the mode of tc1m to the ppg mode.
page 78 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG figure 8-7 ppg output example :generating a pulse which is high-going for 800 s and low-going for 200 s (fc = 16 mhz) setting port ld (tc1cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc1dra), 007dh ; sets the cycle (1 ms 2 7 /fc ms = 007dh) ldw (tc1drb), 0019h ; sets the low-level pulse width (200 s 2 7 /fc = 0019h) ld (tc1cr), 10010111b ; starts the timer example :after stopping ppg, setting the ppg pin to a high-level to restart ppg (fc = 16 mhz) setting port ld (tc1cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc1dra), 007dh ; sets the cycle (1 ms 2 7 /fc s = 007dh) ldw (tc1drb), 0019h ; sets the low-level pulse width (200 s 2 7 /fc = 0019h) ld (tc1cr), 10010111b ; starts the timer :: ld (tc1cr), 10000111b ; stops the timer ld (tc1cr), 10000100b ; sets the timer mode ld (tc1cr), 00000111b ; sets the ppg mode, tff1 = 0 ld (tc1cr), 00010111b ; starts the timer q r d ppg pin function output port output enable i/o port output latch shared with ppg output data output toggle set clear q tc1cr write to tc1cr internal reset match to tc1drb match to tc1dra tc1cr clear timer f/f1 inttc1 interrupt request
page 79 TMP86P807MG figure 8-8 pp g mode timing chart inttc1 tc1dra internal clock counter tc1drb tc1dra ppg pin output 0 inttc1 interrupt request interrupt request 12 m01 2 n m01 n 2 n n + 1 n + 1 m (a) continuous pulse generation (tc1s = 01) tc1drb trigger count start timer start counter internal clock tc1 pin input ppg pin output 0 1m n n n + 1 m 0 (b) one-shot pulse generation (tc1s = 10) match detect note: m > n note: m > n [application] one-shot pulse output
page 80 8. 16-bit timercounter 1 (tc1) 8.3 function TMP86P807MG
page 81 TMP86P807MG 9. 8-bit timercounter (tc3, tc4) 9.1 configuration figure 9-1 8-bit timercounter 3, 4 8-bit up-counter decode en a y b s a b y c d e f g h s a y b s s a y b toggle q set clear 8-bit up-counter a b y c d e f g h s decode en toggle q set clear pwm mode pdo, ppg mode pdo mode pwm, ppg mode pwm mode pwm mode 16-bit mode 16-bit mode 16-bit mode 16-bit mode timer, event counter mode overflow overflow timer, event couter mode 16-bit mode clear clear fc/2 7 fc/2 5 fc/2 3 fc/2 fc fc/2 7 fc/2 5 fc/2 3 fc/2 fc pdo, pwm, ppg mode pdo, pwm mode 16-bit mode fc/2 11 or fs/2 3 fc/2 11 or fs/2 3 fs fs tc4cr tc3cr ttreg4 pwreg4 ttreg3 pwreg3 tc3 pin tc4 pin tc4s tc3s inttc3 interrupt request inttc4 interrupt request tff4 tff3 pdo 4/pwm 4/ ppg 4 pin pdo 3/pwm 3/ pin tc3ck tc4ck tc3m tc3s tff3 tc4m tc4s tff4 timer f/f4 timer f/f3
page 82 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG 9.2 timercounter control the timercounter 3 is controlled by the timercounter 3 control register (tc3cr) and two 8-bit timer registers (ttreg3, pwreg3). note 1: do not change the timer register (t treg3) setting while the timer is running. note 2: do not change the timer register (pwreg3) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock[hz] note 2: do not change the tc3m, tc3ck and tff3 settings while the timer is running. note 3: to stop the timer operation (tc3s= 1 0), do not change the tc3m, tc3ck and tff3 settings. to start the timer opera- tion (tc3s= 0 1), tc3m, tc3ck and tff3 can be programmed. note 4: to use the timercounter in the 16-bit mode, set th e operating mode by programming tc4cr, where tc3m must be fixed to 011. note 5: to use the timercounter in the 16-bit mode, select the source clock by programming tc3ck. set the timer start control and timer f/f control by programming tc4 cr and tc4cr, respectively. note 6: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. timercounter 3 timer register ttreg3 (001ch) r/w 76543210 (initial value: 1111 1111) pwreg3 (001eh) r/w 76543210 (initial value: 1111 1111) timercounter 3 control register tc3cr (001ah) 76543210 tff3 tc3ck tc3s tc3m (initial value: 0000 0000) tff3 time f/f3 control 0: 1: clear set r/w tc3ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc fc (note 8) 111 tc3 pin input tc3s tc3 start control 0: 1: operation stop and counter clear operation start r/w tc3m tc3m operating mode select 000: 001: 010: 011: 1**: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode 16-bit mode (each mode is selectable with tc4m.) reserved r/w
page 83 TMP86P807MG note 7: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 8: the operating clock fc in t he slow or sleep mode can be used only as the high-frequency warm-up mode.
page 84 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG the timercounter 4 is controlled by the timercounter 4 control register (tc4cr) and two 8-bit timer registers (ttreg4 and pwreg4). note 1: do not change the timer register (t treg4) setting while the timer is running. note 2: do not change the timer register (pwreg4) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock [hz] note 2: do not change the tc4m, tc4ck and tff4 settings while the timer is running. note 3: to stop the timer operation (tc4s= 1 0), do not change the tc4m, tc4ck and tff4 settings. to start the timer operation (tc4s= 0 1), tc4m, tc4ck and tff4 can be programmed. note 4: when tc4m= 1** (upper byte in the 16-bit mode), the sour ce clock becomes the tc3 over flow signal regardless of the tc4ck setting. note 5: to use the timercounter in the 16-bit mode, select the operating mode by programming tc4m, where tc3cr must be set to 011. timercounter 4 timer register ttreg4 (001dh) r/w 76543210 (initial value: 1111 1111) pwreg4 (001fh) r/w 76543210 (initial value: 1111 1111) timercounter 4 control register tc4cr (001bh) 76543210 tff4 tc4ck tc4s tc4m (initial value: 0000 0000) tff4 timer f/f4 control 0: 1: clear set r/w tc4ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc ? 111 tc4 pin input tc4s tc4 start control 0: 1: operation stop and counter clear operation start r/w tc4m tc4m operating mode select 000: 001: 010: 011: 100: 101: 110: 111: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode reserved 16-bit timer/event counter mode warm-up counter mode 16-bit pulse width modulation (pwm) output mode 16-bit ppg mode r/w
page 85 TMP86P807MG note 6: to the timercounter in the 16-bit mode, select the so urce clock by programming tc3cr. set the timer start control and timer f/f control by prog ramming tc4s and tff4, respectively. note 7: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. note 8: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 1: for 16-bit operations (16-bit timer/event counter, warm- up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). note 2: : available source clock table 9-1 operating mode and selectable source clock (normal1/2 and idle1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer ??? ????? 8-bit event counter ??????? 8-bit pdo ??? ????? 8-bit pwm ?????? ?? 16-bit timer ??? ????? 16-bit event counter ??????? ? warm-up counter ???? ???? 16-bit pwm ??????? ? 16-bit ppg ??? ??? ? table 9-2 operating mode an d selectable source clock (slow1/2 and sleep1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer ???????? 8-bit event counter ??????? ? 8-bit pdo ???????? 8-bit pwm ??? ???? 16-bit timer ???????? 16-bit event counter ??????? ? warm-up counter ?????? ?? 16-bit pwm ??? ?? ? 16-bit ppg ?????? ? note1: note2: for 16-bit operations (16-bit timer/event counter, warm-up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). : available source clock
page 86 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG note: n = 3 to 4 table 9-3 constraints on register values being compared operating mode register value 8-bit timer/event counter 1 (ttregn) 255 8-bit pdo 1 (ttregn) 255 8-bit pwm 2 (pwregn) 254 16-bit timer/event counter 1 (ttreg4, 3) 65535 warm-up counter 256 (ttreg4, 3) 65535 16-bit pwm 2 (pwreg4, 3) 65534 16-bit ppg 1 (pwreg4, 3) < (ttreg4, 3) 65535 and (pwreg4, 3) + 1 < (ttreg4, 3)
page 87 TMP86P807MG 9.3 function the timercounter 3 and 4 have the 8-bit timer, 8-bit ev ent counter, 8-bit programmable divider output (pdo), 8- bit pulse width modulation (pwm) output modes. the time rcounter 3 and 4 (tc3, 4) are cascadable to form a 16- bit timer. the 16-bit timer has the operat ing modes such as the 16-bit timer, 16-bit event counter, warm-up counter, 16-bit pulse width modulation (pwm) output and 16-bit programmable pulse generation (ppg) modes. 9.3.1 8-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register j (ttregj) value is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cl eared, the up-counter restarts counting. note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed while the timer is r unning, an expected operation may not be obtained. note 3: j = 3, 4 table 9-4 source clock for timercounter 3, 4 (internal clock) source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.6 ms 62.3 ms fc/2 7 fc/2 7 ?8 s ? 2.0 ms ? fc/2 5 fc/2 5 ?2 s ? 510 s? fc/2 3 fc/2 3 ? 500 ns ? 127.5 s? example :setting the timer mode with source clock fc/2 7 hz and generating an interrupt 80 s later (timercounter4, fc = 16.0 mhz) ld (ttreg4), 0ah : sets the timer register (80 s 2 7 /fc = 0ah). di set (eirh). 3 : enables inttc4 interrupt. ei ld (tc4cr), 00010000b : sets the operating clock to fc/2 7 , and 8-bit timer mode. ld (tc4cr), 00011000b : starts tc4.
page 88 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG figure 9-2 8-bit timer mode timing chart (tc4) 9.3.2 8-bit event counter mode (tc3, 4) in the 8-bit event counter mode, the up-counter counts up at the falling edge of the input pulse to the tcj pin. when a match between the up-counter and the ttregj valu e is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counti ng at the falling edge of the input pulse to the tcj pin. two machine cycles are required for the low- or high-level pulse input to the tcj pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 hz in the slow1/2 or sleep1/2 mode. note 1: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the event counter mode, do not change the ttre gj setting while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed whil e the timer is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-3 8-bit event count er mode timing chart (tc4) 9.3.3 8-bit programmable divi der output (pdo) mode (tc3, 4) this mode is used to generate a pu lse with a 50% duty cycle from the pdoj pin. in the pdo mode, the up-counter counts up using the internal clock. when a match between the up-counter and the ttregj value is detected , the logic level output from the pdoj pin is switched to the opposite state and the up-counter is cleared. the inttcj interrupt request is generated at the time. the logic state opposite to the timer f/fj logic level is output from the pdoj pin. an arbitrary value can be set to the timer f/fj by tcjcr. upon reset, the timer f/fj value is initialized to 0. to use the programmable divider output, set the output latch of the i/o port to 1. 1 2 3 n-1 n 0 1 n-1 n 2 0 1 2 0 n ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg4 inttc4 interrupt request 1 0 2 n-1 n 0 1 2 0 n ? counter match detect counter clear n-1 n 2 0 1 match detect counter clear tc4cr ttreg4 inttc4 interrupt request tc4 pin input
page 89 TMP86P807MG note 1: in the programmable divider output mode, do not change the ttregj setting while the timer is running. since ttregj is not in the shift register configur ation in the programmable divider output mode, the new value programmed in ttregj is in effect immediatel y after programming. therefore, if ttregi is changed while the timer is running, an ex pected operation may not be obtained. note 2: when the timer is stopped during pdo output, the pdoj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr setting upon stopping of the timer. example: fixing the pdoj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pdoj pin to the high level. note 3: j = 3, 4 example :generating 1024 hz pulse using tc4 (fc = 16.0 mhz) setting port ld (ttreg4), 3dh : 1/1024 2 7 /fc 2 = 3dh ld (tc4cr), 00010001b : sets the operating clock to fc/2 7 , and 8-bit pdo mode. ld (tc4cr), 00011001b : starts tc4.
page 90 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG figure 9-4 8-bit pdo mode timing chart (tc4) 12 0 n 0 n 0 n 0 n 0 1 2 2 1 2 1 2 3 1 0 n ? internal source clock counter match detect match detect match detect match detect held at the level when the timer is stopped set f/f write of "1" tc4cr tc4cr ttreg4 timer f/f4 pdo 4 pin inttc4 interrupt request
page 91 TMP86P807MG 9.3.4 8-bit pulse wi dth modulation (pwm) output mode (tc3, 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 8 bits of resolution. the up-counter counts up using the internal clock. when a match between the up-counter and the pwregj value is detected, the logic level output from the timer f/fj is switched to the opposite state. the counter continues counting. the logic level output from the timer f/fj is switched to the opposite state again by the up-co unter overflow, and the counter is cleared. the inttcj interrupt request is generated at this time. since the initial value can be set to the timer f/fj by tcjcr, positive and negative pulses can be gen- erated. upon reset, the tim er f/fj is cleared to 0. (the logic level output from the pwmj pin is the opposite to the timer f/fj logic level.) since pwregj in the pwm mode is se rially connected to the shift regist er, the value set to pwregj can be changed while the timer is running. the value set to pwregj during a run of the timer is shifted by the inttcj interrupt request and loaded into pwregj. while the timer is stopped, the value is shifted immedi- ately after the programming of pwre gj. if executing the read instruction to pwregj during pwm output, the value in the shift register is read, but not the valu e set in pwregj. therefore, after writing to pwregj, the reading data of pwregj is previo us value until inttcj is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pw regj immediately after the inttcj interrupt request is generated (normally in the inttcj interrupt service r outine.) if the programming of pwregj and the inter- rupt request occur at the same time, an unstable value is shifted, that may result in generation of the pulse different from the programmed value until the next inttcj interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwmj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr upon stopping of the timer. example: fixing the pwmj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pwmj pin to the high level. note 3: to enter the stop mode during pwm output, stop the timer and then enter the stop mode. if the stop mode is entered without stopping the timer when fc, fc/2 or fs is selected as the source clock, a pulse is out- put from the pwmj pin during the warm-up period time after exiting the stop mode. note 4: j = 3, 4 table 9-5 pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.8 ms 62.5 ms fc/2 7 fc/2 7 ?8 s?2.05 ms? fc/2 5 fc/2 5 ?2 s ? 512 s? fc/2 3 fc/2 3 ? 500 ns ? 128 s? fs fs fs 30.5 s30.5 s 7.81 ms 7.81 ms fc/2 fc/2 ? 125 ns ? 32 s? fc fc ? 62.5 ns ? 16 s?
page 92 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG figure 9-5 8-bit pwm mo de timing chart (tc4) 1 0 nn+1 ff 0 n n+1 ff 0 1 m m+1 ff 0 1 1 p n ? internal source clock counter m p m p n ? shift registar shift shift shift shift match detect match detect one cycle period match detect match detect n m p n tc4cr tc4cr pwreg4 timer f/f4 pwm 4 pin inttc4 interrupt request write to pwreg4 write to pwreg4
page 93 TMP86P807MG 9.3.5 16-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. the timercounter 3 and 4 are cascad- able to form a 16-bit timer. when a match between the up-counter and the timer regi ster (ttreg3, ttreg4) valu e is detected after the timer is started by setting tc4cr to 1, an inttc 4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter continues counting. pr ogram the lower byte and upper byte in this order in the timer register. (programming only the uppe r or lower byte should not be attempted.) note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj , and ppgj pins may output a pulse. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after programming of ttregj. therefore, if ttreg j is changed while the time r is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-6 16-bit timer m ode timing chart (tc3 and tc4) table 9-6 source clock for 16-bit timer mode source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 fs/2 3 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? example :setting the timer mode with source clock fc/2 7 hz, and generating an interrupt 300 ms later (fc = 16.0 mhz) ldw (ttreg3), 927ch : sets the timer register (300 ms 2 7 /fc = 927ch). di set (eirh). 3 : enables inttc4 interrupt. ei ld (tc3cr), 13h :sets the operating clock to fc/2 7 , and 16-bit timer mode (lower byte). ld (tc4cr), 04h : sets the 16-bit timer mode (upper byte). ld (tc4cr), 0ch : starts the timer. 1 0 2 3 mn-1 mn 0 1 mn-1 mn 2 0 1 2 0 n ? m ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg3 (lower byte) inttc4 interrupt request ttreg4 (upper byte)
page 94 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG 9.3.6 16-bit event c ounter mode (tc3 and 4) 9.3.7 16-bit pulse width modulatio n (pwm) output mode (tc3 and 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 16 bits of resolution. the timercounter 3 and 4 are cascadable to form the 16-bit pwm signal generator. the counter counts up using the internal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again by the counter overflow, and the counter is cleared. the inttc4 interrupt is generated at this time. two machine cycles are required for the high- or low-level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/2 or sleep1/2 mode. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the pwm 4 pin is the opposite to the timer f/f4 logic level.) since pwreg4 and 3 in the pwm mode are serially connected to the shift register, the values set to pwreg4 and 3 can be changed while the timer is runni ng. the values set to pwreg4 and 3 during a run of the timer are shifted by the inttcj interrupt request and loaded into pwreg4 and 3. while the timer is stopped, the values are shifted i mmediately after the programming of pwreg4 and 3. set the lower byte (pwreg3) and upper byte (pwreg4) in this order to program pwreg4 and 3. (programming only the lower or upper byte of the register should not be attempted.) if executing the read instruction to pwreg4 and 3 during pwm output, the values set in the shift register is read, but not the values set in pwreg4 and 3. therefore, after writing to the pwreg4 and 3, reading data of pwreg4 and 3 is previous value until inttc4 is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pwreg4 and 3 immediately after the inttc4 interrupt request is generated (normally in the inttc4 interrupt service routine.) if the programming of pwregj and the interrupt request occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next inttc4 interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwm 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not program tc4cr upon stopping of the timer. example: fixing the pwm 4 pin to the high level when the timercounter is stopped in the event counter mode, the up-counter counts up at the falling edge to the tc3 pin. the timercounter 3 and 4 are cascadable to fo rm a 16-bit event counter. when a match between the up-counter and the timer register (ttreg3, ttreg4) value is detected after the timer is started by setting tc4cr to 1, an inttc4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter rest arts counting at the falling edge of the input pulse to the tc3 pin. two machine cycles are required for the low- or high-level pulse input to the tc3 pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/ 2 4 in the slow1/2 or sleep1/2 mode. program the lo wer byte (ttreg3), and upper byte (ttreg4) in this order in the timer register. (programming only the upper or lower byte should not be attempted.) note 1: note 2: note 3: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. in the event counter mode, do not change the ttregj setti ng while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect imme- diately after the programming. therefore, if ttregj is changed while the timer is running, an expected operation may not be obtained. j = 3, 4
page 95 TMP86P807MG clr (tc4cr).3: stops the timer. clr (tc4cr).7 : sets the pwm 4 pin to the high level. note 3: to enter the stop mode, stop the timer and then enter the stop mode. if the stop mode is entered with- out stopping of the timer when fc, fc/2 or fs is select ed as the source clock, a pulse is output from the pwm 4 pin during the warm-up period time after exiting the stop mode. table 9-7 16-bit pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? fs fs fs 30.5 s30.5 s2 s 2 s fc/2 fc/2 ? 125 ns ? 8.2 ms ? fc fc ? 62.5 ns ? 4.1 ms ? example :generating a pulse with 1-ms high-level width and a period of 32.768 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and 16-bit pwm output mode (lower byte). ld (tc4cr), 056h : sets tff4 to the initial value 0, and 16-bit pwm signal generation mode (upper byte). ld (tc4cr), 05eh : starts the timer.
page 96 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG figure 9-7 16-bit pwm m ode timing chart (tc3 and tc4) 1 0 an an+1 ffff 0 an an+1 ffff 0 1 bm bm+1 ffff 0 bm cp b c 1 1 cp n a an ? ? ? internal source clock 16-bit shift register shift shift shift shift counter match detect match detect one cycle period match detect match detect an bm cp an m p tc4cr tc4cr pwreg3 (lower byte) timer f/f4 pwm 4 pin inttc4 interrupt request pwreg4 (upper byte) write to pwreg4 write to pwreg4 write to pwreg3 write to pwreg3
page 97 TMP86P807MG 9.3.8 16-bit programmable pulse generate (ppg) ou tput mode (tc3 and 4) this mode is used to generate pulses with up to 16- bits of resolution. the timer counter 3 and 4 are cascad- able to enter the 16-bit ppg mode. the counter counts up using the inte rnal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4 ) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again when a match betw een the up-counter and th e timer register (ttreg3, ttreg4) value is detected, and the counter is cleared. the inttc4 interrupt is generated at this time. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the ppg 4 pin is the opposite to the timer f/f4.) set the lower byte and upper byte in this order to program the timer register. (ttreg3 ttreg4, pwreg3 pwreg4) (programming only the upper or lower byte should not be attempted.) for ppg output, set the output latch of the i/o port to 1. note 1: in the ppg mode, do not change the pwregi and ttregi settings while the timer is running. since pwregi and ttregi are not in the shift register c onfiguration in the ppg mode, the new values pro- grammed in pwregi and ttregi are in effect immediately after progra mming pwregi and ttregi. therefore, if pwregi and ttregi are changed whil e the timer is running, an expected operation may not be obtained. note 2: when the timer is stopped during ppg output, the ppg 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not change tc4cr upon stopping of the timer. example: fixing the ppg 4 pin to the high level when the timercounter is stopped clr (tc4cr).3: stops the timer clr (tc4cr).7: sets the ppg 4 pin to the high level note 3: i = 3, 4 two machine cycles are required for the high- or low- level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/ 2 or sleep1/2 mode. example :generating a pulse with 1-ms high-level width and a period of 16.385 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ldw (ttreg3), 8002h : sets the cycle period. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and16-bit ppg mode (lower byte). ld (tc4cr), 057h : sets tff4 to the initial value 0, and 16-bit ppg mode (upper byte). ld (tc4cr), 05fh : starts the timer.
page 98 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG figure 9-8 16-bit ppg mode timing chart (tc3 and tc4) 1 0 mn mn+1 qr-1 mn qr-1 1 mn mn+1 mn+1 0 qr 0 qr 1 0 internal source clock counter write of "0" match detect match detect match detect mn mn mn match detect match detect ? n m ? ? r q ? held at the level when the timer stops f/f clear tc4cr tc4cr pwreg3 (lower byte) timer f/f4 ppg 4 pin inttc4 interrupt request pwreg4 (upper byte) ttreg3 (lower byte) ttreg4 (upper byte)
page 99 TMP86P807MG 9.3.9 warm-up counter mode in this mode, the warm-up period time is obtained to assure oscillation stability when the system clocking is switched between the high-frequency and low-frequency. the timer counter 3 and 4 are cascadable to form a 16-bit timercounter. the warm-up counter mode has two types of mode; switching from the high-frequency to low-frequency, and vice-versa. note 1: in the warm-up counter mode, fi x tcicr to 0. if not fixed, the pdoi , pwmi and ppgi pins may output pulses. note 2: in the warm-up counter mode, only upper 8 bits of the timer register ttreg4 and 3 are used for match detection and lower 8 bits are not used. note 3: i = 3, 4 9.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) in this mode, the warm-up period time from a stop of the low-frequency clock fs to oscillation stability is obtained. before starting the timer, set syscr2 to 1 to oscillate the low-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, set syscr2 to 1 to switch the system clock from the high-frequency to low-frequency, and then clear of syscr2 to 0 to stop the high-frequency clock. table 9-8 setting time of low-frequen cy warm-up counter mode (fs = 32.768 khz) minimum time setting (ttreg4, 3 = 0100h) maximum time setting (ttreg4, 3 = ff00h) 7.81 ms 1.99 s example :after check ing low-frequency clock oscillation stability with tc4 and 3, switching to the slow1 mode set (syscr2).6 : syscr2 1 ld (tc3cr), 43h : sets tff3=0, source clock fs, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 8000h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 3 : enables the inttc4. ei : imf 1 set (tc4cr).3 : starts tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops tc4 and 3. set (syscr2).5 : syscr2 1 (switches the system clock to the low-frequency clock.) clr (syscr2).7 : syscr2 0 (stops the high-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 100 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86P807MG 9.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) in this mode, the warm-up period time from a stop of the high-frequency clock fc to the oscillation sta- bility is obtained. before starting the timer, set sy scr2 to 1 to oscillat e the high-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, clear syscr2 to 0 to switch the system clock from the low-frequency to high-frequency, and then syscr2 to 0 to stop the low-frequency clock. table 9-9 setting time in high-frequency warm-up counter mode minimum time setting (ttreg4, 3 = 0100h) maximum time setting (ttreg4, 3 = ff00h) 16 s 4.08 ms example :after check ing high-frequency clock oscillation stability with tc4 and 3, switching to the normal1 mode set (syscr2).7 : syscr2 1 ld (tc3cr), 63h : sets tff3=0, source clock fc, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 0f800h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 3 : enables the inttc4. ei : imf 1 set (tc4cr).3 : starts the tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops the tc4 and 3. clr (syscr2).5 : syscr2 0 (switches the system clock to the high-frequency clock.) clr (syscr2).6 : syscr2 0 (stops the low-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 101 TMP86P807MG 10. asynchronous serial interface (uart ) 10.1 configuration figure 10-1 uart (asynch ronous serial interface) counter y a b c s s a b c d y e f g h uart status register uart control register 2 uart control register 1 transmit data buffer receive data buffer fc/13 fc/26 fc/52 fc/104 fc/208 fc/416 fc/96 stop bit parity bit fc/2 6 fc/2 7 fc/2 8 baud rate generator transmit/receive clock 2 4 3 2 2 2 noise rejection circuit m p x transmit control circuit shift register shift register receive control circuit mpx: multiplexer uartcr1 tdbuf rdbuf inttxd intrxd uartsr uartcr2 rxd txd inttc3
page 102 10. asynchronous serial interface (uart ) 10.2 control TMP86P807MG 10.2 control uart is controlled by the uart control registers (uartcr1, uartcr2). the operating status can be moni- tored using the uart status register (uartsr). note 1: when operations are disabled by se tting txe and rxe bit to ?0?, the setting be comes valid when data transmit or receive complete. when the transmit data is stored in the transmit data buf fer, the data are not transmitted. even if data transmit is enabled, until new data are written to the transmit data buffer, the current data are not transmitted. note 2: the transmit clock and the parity are common to transmit and receive. note 3: uartcr1 and uartcr1 should be set to ?0? before uartcr1 is changed. note: when uartcr2 = ?01?, pulses longer than 96/fc [s] are always regarded as signals; when uartcr2 = ?10?, longer than 192/fc [s]; and when uart cr2 = ?11?, longer than 384/fc [s]. uart control register1 uartcr1 (0025h) 76543210 txe rxe stbt even pe brg (initial value: 0000 0000) txe transfer operation 0: 1: disable enable write only rxe receive operation 0: 1: disable enable stbt transmit stop bit length 0: 1: 1 bit 2 bits even even-numbered parity 0: 1: odd-numbered parity even-numbered parity pe parity addition 0: 1: no parity parity brg transmit clock select 000: 001: 010: 011: 100: 101: 110: 111: fc/13 [hz] fc/26 fc/52 fc/104 fc/208 fc/416 tc3 ( input inttc3) fc/96 uart control register2 uartcr2 (0026h) 7654321 0 rxdnc stopbr (initial value: **** *000) rxdnc selection of rxd input noise rejection time 00: 01: 10: 11: no noise rejection (hysteresis input) rejects pulses shorter than 31/fc [s] as noise rejects pulses shorter than 63/fc [s] as noise rejects pulses shorter than 127/fc [s] as noise write only stopbr receive stop bit length 0: 1: 1 bit 2 bits
page 103 TMP86P807MG note: when an inttxd is generated, tbep flag is set to "1" automatically. uart status register uartsr (0025h) 76543210 perr ferr oerr rbfl tend tbep (initial value: 0000 11**) perr parity error flag 0: 1: no parity error parity error read only ferr framing error flag 0: 1: no framing error framing error oerr overrun error flag 0: 1: no overrun error overrun error rbfl receive data buffer full flag 0: 1: receive data buffer empty receive data buffer full tend transmit end flag 0: 1: on transmitting transmit end tbep transmit data buffer empty flag 0: 1: transmit data buffer full (transmit data writing is finished) transmit data buffer empty uart receive data buffer rdbuf (0027h) 76543210read only (initial value: 0000 0000) uart transmit data buffer tdbuf (0027h) 76543210write only (initial value: 0000 0000)
page 104 10. asynchronous serial interface (uart ) 10.3 transfer data format TMP86P807MG 10.3 transfer data format in uart, an one-bit start bit (low level), stop bit (bit length selectable at high level, by uartcr1), and parity (select parity in uartcr1

; even- or odd-number ed parity by uartcr1) are added to the transfer data. the transfer data formats are shown as follows. figure 10-2 tran sfer data format figure 10-3 caution on c hanging transfer data format note: in order to switch the transfer data format, perfor m transmit operations in the above figure 10-3 sequence except for the initial setting. start bit 0 bit 1 bit 6 bit 7 stop 1 start bit 0 bit 1 bit 6 bit 7 stop 1 stop 2 start bit 0 bit 1 bit 6 bit 7 parity stop 1 start bit 0 bit 1 bit 6 bit 7 parity stop 1 stop 2 pe 0 0 1 1 stbt frame length 0 1 123 89101112 0 1 without parity / 1 stop bit with parity / 1 stop bit without parity / 2 stop bit with parity / 2 stop bit
page 105 TMP86P807MG 10.4 transfer rate the baud rate of uart is set of uartcr1. th e example of the baud rate are shown as follows. when tc3 is used as the uart transfer rate (when uartcr1 = ?110?), the tr ansfer clock and transfer rate are determined as follows: transfer clock [hz] = tc3 source clock [hz] / ttreg3 setting value transfer rate [baud] = transfer clock [hz] / 16 10.5 data sampling method the uart receiver keeps sampling input using the cloc k selected by uartcr1 until a start bit is detected in rxd pin input. rt clock star ts detecting ?l? level of the rxd pin. once a start bit is detected, the start bit, data bits, stop bi t(s), and parity bit are sampled at three times of rt7, rt8, and rt9 during one receiver clock interval (rt clock). (rt0 is the position where the bit supposedly starts.) bit is determined according to majority rule (the data are the same twice or more out of three samplings). figure 10-4 data sampling method table 10-1 transfer rate (example) brg source clock 16 mhz 8 mhz 4 mhz 000 76800 [baud] 38400 [baud] 19200 [baud] 001 38400 19200 9600 010 19200 9600 4800 011 9600 4800 2400 100 4800 2400 1200 101 2400 1200 600 rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit (a) without noise rejection circuit rt clock internal receive data rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit rt clock internal receive data (b) with noise rejection circuit rxd pin rxd pin
page 106 10. asynchronous serial interface (uart ) 10.6 stop bit length TMP86P807MG 10.6 stop bit length select a transmit stop bit length (1 bit or 2 bits) by uartcr1. 10.7 parity set parity / no parity by uartcr1 and set parity type (odd- or even-numbered) by uartcr1. 10.8 transmit/receive operation 10.8.1 data transmit operation set uartcr1 to ?1?. read uartsr to check ua rtsr = ?1?, then write data in tdbuf (transmit data buffer). writing data in tdbuf zero-cl ears uartsr, transfers the data to the transmit shift register and the data are sequenti ally output from the txd pin. the data output include a one-bit start bit, stop bits whose number is specified in uartcr1 and a parity bit if parity addition is specified. select the data transfer baud rate using uartcr1. when data transmit st arts, transmit buffer empty flag uartsr is set to ?1? a nd an inttxd interrupt is generated. while uartcr1 = ?0? and from when ?1? is written to uartcr1 to when send data are written to tdbuf, the txd pin is fixed at high level. when transmitting data, first read uartsr, then write data in tdbuf. otherwise, uartsr is not zero-cleared and transm it does not start. 10.8.2 data receive operation set uartcr1 to ?1?. when data are received vi a the rxd pin, the receive data are transferred to rdbuf (receive data buffer). at this time, the data transmitted includes a start bit and stop bit(s) and a parity bit if parity addition is specified. when stop bit(s) are received, data only are extracted and transferred to rdbuf (receive data buffer). then the receive buffer full flag ua rtsr is set and an intrxd interrupt is generated. select the data transfer baud rate using uartcr1. if an overrun error (oerr) occurs when data are received, the da ta are not transferre d to rdbuf (receive data buffer) but discarded; data in the rdbuf are not affected. note:when a receive operation is disabled by setting ua rtcr1 bit to ?0?, the setting becomes valid when data receive is completed. however, if a framing error occurs in data receive, the receive-disabling setting may not become valid. if a framing error occurs , be sure to perform a re-receive operation.
page 107 TMP86P807MG 10.9 status flag 10.9.1 parity error when parity determined using the receive data bits diff ers from the received parity bit, the parity error flag uartsr is set to ?1?. the uartsr is cl eared to ?0? when the rdbuf is read after read- ing the uartsr. figure 10-5 generati on of parity error 10.9.2 framing error when ?0? is sampled as the stop bit in the receive data, framing error flag uartsr is set to ?1?. the uartsr is cleared to ?0? when the rdbuf is r ead after reading the uartsr. figure 10-6 generati on of framing error 10.9.3 overrun error when all bits in the next data are received while unread data are still in rdbuf, overrun error flag uartsr is set to ?1?. in this case, the receive data is discarded; data in rdbuf are not affected. the uartsr is cleared to ?0? when the rdbuf is read af ter reading the uartsr. parity stop shift register pxxxx0 * 1pxxxx0 xxxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears perr. final bit stop shift register xxxx0 * 0xxxx0 xxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears ferr.
page 108 10. asynchronous serial interface (uart ) 10.9 status flag TMP86P807MG figure 10-7 generati on of overrun error note:receive operations are di sabled until the overrun error flag uartsr is cleared. 10.9.4 receive data buffer full loading the received data in rdbuf sets receive data buffer full flag uartsr to "1". the uartsr is cleared to ?0? when the rdbuf is read after reading the uartsr. figure 10-8 generat ion of receive data buffer full note:if the overrun error flag uartsr is set during the period between reading the uartsr and reading the rdbuf, it cannot be cleared by only reading the rdbuf. therefore, after reading the rdbuf, read the uartsr again to check whether or not the overrun er ror flag which should have been cleared still remains set. 10.9.5 transmit data buffer empty when no data is in the transmit buffer tdbuf, that is, when data in tdbuf are transferred to the transmit shift register and data transmit starts, transmit data buffer empty flag uartsr is set to ?1?. the uartsr is cleared to ?0 ? when the tdbuf is writte n after reading the uartsr. final bit stop shift register xxxx0 * 1xxxx0 yyyy xxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears oerr. rdbuf uartsr final bit stop shift register xxxx0 * 1xxxx0 xxxx yyyy xxx0 ** rxd pin uartsr intrxd interrupt rdbuf after reading uartsr then rdbuf clears rbfl.
page 109 TMP86P807MG figure 10-9 generation of transmit data buffer empty 10.9.6 transmit end flag when data are transmitted and no data is in tdbuf (uartsr = ?1?), transmit end flag uartsr is set to ?1?. the uartsr is clear ed to ?0? when the data transmit is started after writing the tdbuf. figure 10-10 generation of transmit end flag and transmit data buffer empty shift register data write data write zzzz xxxx yyyy start bit 0 final bit stop 1xxxx0 ***** 1 * 1xxxx **** 1x ***** 1 1yyyy0 tdbuf txd pin uartsr inttxd interrupt after reading uartsr writing tdbuf clears tbep. shift register * 1yyyy *** 1 xx **** 1 x ***** 1 stop start 1yyyy0 bit 0 txd pin uartsr uartsr inttxd interrupt data write for tdbuf
page 110 10. asynchronous serial interface (uart ) 10.9 status flag TMP86P807MG
page 111 TMP86P807MG 11. serial expansion interface (sei) sei is one of the serial interfaces in corporated in the tmp86p8 07mg. it allows connecti on to peripheral devices via full-duplex synchronous communication protocol s. the TMP86P807MG cont ain one channel of sei. sei is connected with an ex ternal device through sclk, mosi, miso and the terminal ss . sclk, mosi, miso, and ss pins respectively are shared with p02, p03, p04 and p05. when using these ports as sclk, mosi, miso, or ss pins, set the each port output latch to ?1?. 11.1 features ? the master outputs the shift clock for only a data transfer period. ? the clock polarity and phase are programmable. ? the data is 8 bits long. ? msb or lsb-first can be selected. ? the programmable data and clock timing of sei can be connected to almost all synchronous serial peripheral devices. refer to ?" 11.5 sei transfer formats "?. ? the transfer rate can be selected from the following four (master only): 4 mbps, 2 mbps, 1 mbps, or 250 kbps (when operating at 16 mhz) ? the error detection circuit su pports the following functions: a. write collision detection: when the shift register is accessed for write during transfer b. overflow detection: when new data is received wh ile the transfer-finished fl ag is set (slave only) note: mode fault detect function is not supported. make sure to set secr bit to "1" for disabling the mode fault detection. figure 11-1 sei (ser ial extended interface) sei control unit port control unit clock control unit shift register read buffer sei control register sei status register bit order selection clock selection 4, 8, 16, 64 divide miso mode mstr cpha cpol bos ser sef wcol sovf see mosi sclk ss sei data register address data sei interrupt (intsei1) internal sei clock
page 112 11. serial expansion interface (sei) 11.2 sei registers TMP86P807MG 11.2 sei registers the sei interface has the sei control register (secr), sei status register (sesr), and sei data register (sedr) which are used to set up the sei system and enable/dis able sei operation. 11.2.1 sei control register (secr) 11.2.1.1 transfer rate (1) master mode (transfer rate = fc/int ernal clock divide ratio (unit : bps)) the table below shows the relationship between settings of the ser bit and transfer bit rates when the sei is operating as the master. 76543210 secr (002ah) mode see bos mstr cpol cpha ser (initial value: 0000 0100) read-modify-write instruction are prohibited mode mode fault detection #1 #1 if mode fault detection is enabled, an interrupt is generated when the modf flag (sesr) is set. 0: enables mode fault detection 1: disables mode fault detection it is available in master mode only. (note: make sure to set bit to "1" for disabling mode fault detection r/w see sei operation #2 #2 sei operation can only be disabled after transfer is co mpleted. before the sei can be used, the each port control register and output latch control must be set for the sei function (in case p0 port, p0outcr and p0dr). when using the sei as the master, set the secr bit to ?1? (to enable sei operation) and then place transmit data in the sedr register. this initiates transmission/reception. 0: disables sei operation 1: enables sei operation bos bit order selection 0: transmitted beginning with the msb (bit 7) of sedr register 1: transmitted beginning with the lsb (bit 0) of sedr register mstr mode selection #3 #3 master/slave settings must be made before enabling sei operation (this means that the secr bit must first be set before setting the secr bit to ?1?). 0: sets sei for slave 1: sets sei for master cpol clock polarity 0: selects active-?h? clock. sclk remains ?l? when idle. 1: selects active-?l? clock. sclk remains ?h? when idle. cpha clock phase selects clock phase. for details, refer to section ?sei transfer for- mats?. ser selects sei transfer rate 00: divide-by-4 01: divide-by-8 10: divide-by-16 11: divide-by-64 table 11-1 sei transfer rate ser internal clock divide ratio of sei transfer rate when fc = 16 mhz 00 4 4 mbps 01 8 2 mbps 10 16 1 mbps 11 64 250 kbps
page 113 TMP86P807MG (2) slave mode when the sei is operating as a slave, the serial clock is input from the master and the setting of the ser bit has no effect. the maximum transfer rate is fc/4. note: take note of the following relationship betwe en the serial clock speed and fc on the master side: 15.625 kbps < transfer rate < fc/4 bps example) 15.625 kbps < transfer rate < 4 mbps (fc = 16 mhz at v dd = 4.5 to 5.5 v) 15.625 kbps < transfer rate < 2 mbps (fc = 8 mhz at v dd = 2.7 to 5.5 v) 11.2.2 sei status register (sesr) 11.2.3 sei data register (sedr) the sei data register (sedr) is used to send and receive data. when the sei is set for master, data transfer is initiated by writing to this sedr register. if the ma ster device needs to write to the sedr register after transfer began, always check to s ee by means of an interrupt or by polling that the sef flag (sesr) is set, before writing to the sedr register. 76543210 sesr (0028h) sef wcol sovf ? (initial value: 0000 ****) sef transfer-finished flag #1 #1 the sef flag is automatically set at completion of trans fer. the sef flag thus se t is automatically cleared by reading the sesr register and accessing the sedr register. 0: transfer in progress 1: transfer completed read only wcol write collision error flag #2 #2 the wcol flag is automatically set by a write to t he sedr register while transfer is in progress. writing to the sedr register during transfer has no effect. the wc ol flag thus set is automat ically cleared by reading the sesr register and accessing the sedr register. no interrupts are generated for reasons that the wcol flag is set. 0: no write collision error occurred 1: write collision error occurred sovf overflow error flag (slave) #3 #3 during master mode: this bit does not function; its data when read is ?0?. during slave mode: the sovf flag is automatically set when the device fini shes reading the next data while the sef flag is set. the sovf flag thus set is automat ically cleared by reading the sesr register and accessing the sedr reg- ister. the sovf flag also is cleared by a switchover to master mode. no interrupts are generated for rea- sons that the sovf flag is set. 0: no overflow occurred 1: overflow occurred 76543210 sedr (0029h) sed7 sed6 sed5 sed4 sed3 sed2 sed1 sed0 r/w (initial value: 0000 0000)
page 114 11. serial expansion interface (sei) 11.3 sei operation TMP86P807MG 11.3 sei operation during a sei transfer, data transmissi on (serial shift-out) and reception (serial shift-in ) are performed simulta- neously. the serial clock synchronizes the timing at which information on the two serial data lines are shifted or sampled. slave device can be selected in dividually using the slave select pin ( ss pin). for unselected slave devices, data on the sei bus cannot be taken in. when operating as the master devices, the ss pin can be used to indicate multiple-master bus connection. 11.3.1 controlling sei clock polarity and phase the sei clock allows its phase and po larity to be selected in software from four combinations available by using two bits, cpha and cpol (secr). the clock polarity is set by cpol to select between act ive-high or active-low (the transfer format is unaf- fected). the clock phase is set by cpha. the master device an d the slave devices to communicate with must have the same clock phase and polarity. if multiple slave devices with differ ent transfer formats exis t on the same bus, the format can be changed to that of the slave device to which to transfer. 11.3.2 sei data and clock timing the programmable data and clock timing of sei allows connection to almost all synchronous serial periph- eral devices. refer to section ?" 11.5 sei transfer formats "?. table 11-2 clock phase and polarity cpha sei control register (secr 002ah) bit 2 cpol sei control register (secr 002ah) bit 3
page 115 TMP86P807MG 11.4 sei pin functions the TMP86P807MG have four input/out put pins associated with sei transfer. the functionality of each pin depends on the sei device?s mode (master or slave). the sclk pin, mosi pin and miso pin of all sei devices are connected with the same name pin to each other . 11.4.1 sclk pin the sclk pin functions as an output pin when sei is se t for master, or as an input pin when sei is set for slave. when sei is set for master, serial clock is output from the sclk pin to external devices. after the master starts transfer, eight serial cl ock pulses are output from the sclk pin only during transfer. when sei is set for slave, the sclk pin functions as an input pin. during data transfer between master and slave, device operation is synchronized by the serial clock output from the master. when the ss pin of the slave device is ?h?, data is not taken in regardless of whether the serial clock is avail- able. for both master and slave devices, data is shifted in and ou t at a rising or falling edge of the serial clock, and is sampled at the opposite edge where the data is stable . the active edge is determin ed by sei transfer proto- cols. note:noise in a slave device?s sclk input may cause the device to operate erratically. 11.4.2 miso/mosi pins the miso and mosi pins are used for serial data tr ansmission/reception. the stat us of each pin during mas- ter and slave are shown in the table below. also, the sclk, mosi, and miso pins can be set fo r open-drain by the each pin?s input/output control reg- ister (in case p0 port, input/output control register is p0outcr). the miso pin of a slave device b ecomes an output when the secr bit is set to 1 (sei operation enabled). to set the miso pin of an inactive slave device to a high-imped ance state, clear the secr bit to 0. 11.4.3 ss pin the ss pin function differently when the sei is the master and when it is a slave. when the sei is a slave, this pin is used to en able the sei transmission/r eception. when the slave?s ss pin is high, the slave device ignores the seri al clock from the master. nor does it receive data from the miso pin. when the slave?s ss pin is l, the sei operates as slave. table 11-3 miso/mosi pin status miso mosi master input output slave output input
page 116 11. serial expansion interface (sei) 11.5 sei transfer formats TMP86P807MG 11.5 sei transfer formats the transfer formats are set using cpha and cpol (secr). cpha allows transfer protocols to be selected between two. 11.5.1 cpha (secr regi ster bit 2) = 0 format figure 11-2 shows a transfer format where cpha = 0. figure 11-2 transfer format where cpha = 0 ? in master mode, transfer is initiated by writing ne w data to the sedr register. at this time, the new data changes state on the mosi pin a half clock period before the shift clock starts pulsing. use bos (secr) to select whether the data should be shifted out beginning with the msb or lsb. the sef flag (sesr) is set after the last shift cycle. ? in slave mode, writing data to the sedr register is inhibited when the ss pin is ?l?. a write during this period causes collision of writes, so that the wcol flag (sesr) is set. therefore, when writing data to th e sedr (sei data register) after the sef flag is set upon comple- tion of transfer, make sure the ss pin goes ?h? again before writing th e next data to the sedr register. note:in slave mode, be careful not to write data while the sef flag is set and the ss pin remains ?l?. 11.5.2 cpha = 1 format figure 11-3 shows a transfer format where cpha = 1. table 11-4 transfer format details where cpha = 0 sclk level when not communicating (idle) data shift data sampling cpol = 0 ?l? level falling edge of transfer clock rising edge of transfer clock cpol = 1 ?h? level rising edge of transfer clock falling edge of transfer clock sclk cycle sclk (cpol = 0) sclk (cpol = 1) mosi miso ss sef 1 2 3 4 5 6 7 8 internal shift clock secr
page 117 TMP86P807MG figure 11-3 transfer format where cpha = 1 ? in master mode, transfer is initiated by writing new data to the sedr register. the new data changes state on the mosi pin at the first edge of the shif t clock. use bos (secr) to select whether the data should be shifted out beginning with the msb or lsb. ? in slave mode, unlike in the case of cpha = 0 format, data can be written to the sedr (sei data reg- ister) regardless of whether the ss pin is ?l? or ?h?. in both master and slave modes, the sef flag (sesr) is set after the last shift cycle. writing data to the sedr register while data transf er is in progress causes collision of writes. there- fore, wait until the sef flag is set before writing new data to the sedr register. table 11-5 transfer format details where cpha = 1 sclk level when not communicating (idle) data shift data sampling cpol=0 ?l? level rising edge of transfer clock falling edge of transfer clock cpol=1 ?h? level falling edge of transfer clock rising edge of transfer clock sclk cycle sclk (cpol = 0) sclk (cpol = 1) mosi miso ss sef 1 2 3 4 5 6 7 8 internal shift clock secr
page 118 11. serial expansion interface (sei) 11.6 functional description TMP86P807MG 11.6 functional description figure 11-4 shows how the sei master and slave are connected. when the master device sends data from its mosi pin to a slave device?s mosi pin, the slave device returns data from its miso pin to the master device?s miso pin. this means that data are exchanged between master and slave via full-duplex communication, with data output and input operations synchronized by the same clock signal. after end of transfer, the transmit byte in 8 bit shif t register is replaced with the receive byte. figure 11-4 master and slave connection in sei 8-bit shift register sei clock ss 8-bit shift register mosi master slave miso sclk mosi miso sclk 5 v 0v ss
page 119 TMP86P807MG 11.7 interrupt generation the sei for the TMP86P807MG uses in tsei1. when the sesr changes state from ?0? to ?1?, respective interrupts is generated. 11.8 sei system errors the sei has the facility to det ect following two system errors. ? write collision error: when the sedr register is acce ssed for write during transfer. ? overflow error: when the new data byte is shift in before the previous data byte is read in slave mode. 11.8.1 write collision error collision of writes occurs when an attempt is made to write to the sedr register while transfer is in progress. because the sedr register is not configured as dual-buffers when sending data, a write to the sedr register directly results in writing to the sei shift regi ster. therefore, writing to th e sedr register while trans- fer is in progress causes a write collision error. in no case is data transfer stopped in the middle, so that the write data which caused a write collision error will not be written to the shift regist er. because slaves cannot control the timing at which the master starts a transfer, collision of writes norma lly occurs on the slave side. write collision errors do no t normally occur on the master side because the master has the right to perform a transfer at any time, but in view of sei logic both the master and slaves have the facility to detect write colli- sion errors. a write collision error tends to occur on the slave side when the master sh ifts out data at a speed faster than that at which the slave processes the transferred data. more specifically, a write col lision error occurs in cases where the slave transfers a ne w value to the sedr register when the master already st arted a shift cycle for the next byte. 11.8.2 overflow error the transfer bit rate on the sei bus is determined by the master. a high bit rate causes a problem that a slave cannot keep abreast with transf er from the master, because the master is shifting out data faster than can be pro- cessed by the slave. the sei module uses the sovf flag (ses r) to detect that data has overflowed. the sovf flag is set in the following cases: ? when the sei module is set for slave ? when the old data byte remains to be read while a new data byte has been received when the sovf flag is set, the sedr regi ster is overwritten with a new data byte. note:please carefully examine the communication proc essing routine and communication rate when designing your application system. table 11-6 sei interrupt sei interrupt channel 1 (intsei1) interrupt generated for sef
page 120 11. serial expansion interface (sei) 11.9 bus driver protection TMP86P807MG 11.9 bus driver protection ? one method to protect the device against latch-up due to collision of the bus drivers is the use of an open- drain option. this means changing the sei pins? cmos outputs to the open-drain type, which is accom- plished by setting the sclk, mosi, a nd miso pins for open-drain indi vidually by using the each port input/output control register. in this case, these pins mu st be provided with pull-up resistors external to the chip. ? when using the sei pins as cmos outputs, we recommend connecting them to the bus via resistors in order to protect the device against collision of drivers. however, be sure to se lect the appropriate resistance value which will not affect actual device operation (example: 1 ? to several k ? ).
page 121 TMP86P807MG 12. 8-bit ad converter (adc) the TMP86P807MG have a 8-bit successi ve approximation type ad converter. 12.1 configuration the circuit configuration of the 8-bit ad converter is shown in figure 12-1. it consists of control registers adccr1 and adccr2, converted value registers adcdr1 and adcdr2, a da converter, a sample-and-hold circuit, a comp arator, and a successive comparison circuit. figure 12-1 8-bit ad converter (adc) 3 4 8 8 ainds analog input multiplexer adrs r/2 r/2 r ack irefon ad conversion result register1,2 ad converter control register 1,2 adbf eocf intadc interrupt sain successive approximate circuit adccr2 adcdr1 adcdr2 adccr1  sample hold circuit 0 y to n s en shift clock da converter reference voltage analog comparator control circuit vdd ain0 ain5 vss
page 122 12. 8-bit ad converter (adc) 12.1 configuration TMP86P807MG 12.2 control the ad converter consists of the following four registers: 1. ad converter control register 1 (adccr1) this register selects the analog channels in which to perform ad conversion and controls the ad con- verter as it starts operating. 2. ad converter control register 2 (adccr2) this register selects the ad conver sion time and controls the connect ion of the da converter (ladder resistor network). 3. ad converted value register (adcdr1) this register is used to store the digital value after being converted by the ad converter. 4. ad converted value register (adcdr2) this register monitors the oper ating status of the ad converter. note 1: select analog input when ad converter stops (adcdr2 = ?0?). note 2: when the analog input is all use disabl ing, the adccr1 should be set to ?1?. note 3: during conversion, do not perform output instruction to ma intain a precision for all of the pins. and port near to analo g input, do not input intense signaling of change. note 4: the adrs is automatically cl eared to ?0? after starting conversion. note 5: do not set adccr1 newly again during ad conv ersion. before setting adccr1 newly again, check adcdr2 to see that the conversion is completed or wait until the interrupt signal (intadc) is generated (e.g., interrupt handling routine). note 6: after stop or slow/sleep mode are started, ad conver ter control register 1 (adccr1) is all initialized and no data can be written in this register. therefore, to use ad conv erter again, set the adccr1 newly after returning to normal1 or normal2 mode. note 7: always set bit 5 in adccr1 to ?1? and set bit 6 in adccr1 to ?0?. ad converter control register 1 adccr1 (000eh) 76543210 adrs "0" "1" ainds sain (initial value: 0001 0000) adrs ad conversion start 0: 1: ? start r/w ainds analog input control 0: 1: analog input enable analog input disable sain analog input channel select 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: ain0 ain1 ain2 ain3 ain4 ain5 reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved
page 123 TMP86P807MG note 1: always set bit 0 in adccr2 to ?0? and set bit 4 in adccr2 to ?1?. note 2: when a read instruction for adccr2, bit 6 to 7 in adccr2 read in as undefined data. note 3: after stop or slow/sleep mode are started, ad conver ter control register 2 (adccr2) is all initialized and no data can be written in this register. therefore, to use ad conv erter again, set the adccr2 newly after returning to normal1 or normal2 mode. note 1: settings for ? ? ? in the above table are inhibited. note 2: set conversion time by supply voltage(vdd) as follows. note 1: the adcdr2 is cleared to ?0? when reading the adcdr1. therefore, the ad conversion result should be read to adcdr2 more first than adcdr1. note 2: adcdr2 is set to ?1? when ad conversion starts and cleared to ?0? when the ad conversion is finished. it also is cleared upon entering stop or slow mode. note 3: if a read instruction is executed for adcdr2, read data of bits 7, 6 and 3 to 0 are unstable. ad converter control register 2 adccr2 (000fh) 76543210 irefon ?1? ack ?0? (initial value: **0* 000*) irefon da converter (ladder resistor) connection control 0: 1: connected only during ad conversion always connected r/w ack ad conversion time select 000: 001: 010: 011: 100: 101: 110: 111: 39/fc reserved 78/fc 156/fc 312/fc 624/fc 1248/fc reserved r/w table 12-1 conversion time according to ack setting and frequency condition conbersion time? 16mhz 8mhz 4 mhz 2 mhz 10mhz 5 mhz 2.5 mhz ack 000 39/fc - - - 19.5 s - - 15.6 s 001 reserved 010 78/fc - - 19.5 s39.0 s-15.6 s 31.2 s 011 156/fc - 19.5 s 39.0 s78.0 s 15.6 s 31.2 s 62.4 s 100 312/fc 19.5 s39.0 s 78.0 s 156.0 s 31.2 s 62.4 s 124.8 s 101 624/fc 39.0 s78.0 s156.0 s - 62.4 s 124.8 s- 110 1248/fc 78.0 s 156.0 s- -124.8 s- - 111 reserved - vdd = 4.5 to 5.5 v (15.6 s or more) - vdd = 2.7 to 5.5 v (31.2 s or more) ad conversion result register adcdr1 (0020h) 76543210 ad07 ad06 ad05 ad04 ad03 ad02 ad01 ad00 (initial value: 0000 0000) ad conversion result register adcdr2 (0021h) 76543210 eocf adbf (initial value: **00 ****) eocf ad conversion end flag 0: before or during conversion 1: conversion completed read only adbf ad conversion busy flag 0: during stop of ad conversion 1: during ad conversion
page 124 12. 8-bit ad converter (adc) 12.3 function TMP86P807MG 12.3 function 12.3.1 ad conveter operation when adccr1 is set to "1", ad conversion of the voltage at the analog input pin specified by adccr1 is thereby started. after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdr1) and at the same time adcdr2 is set to ?1?, the ad conversion finished interrupt (intadc) is generated. adccr1 is automatically cleared after ad conversion has started. do not set adccr1 newly again (restart) during ad conversion. before setting adrs newly again, check adcdr to see that the conversion is completed or wait until the inte rrupt signal (intadc) is generated (e.g., interrupt han- dling routine). figure 12-2 ad c onverter operation 12.3.2 ad converter operation 1. set up the ad converter control register 1 (adccr1) as follows: ? choose the channel to ad convert using ad input channel select (sain). ? specify analog input enable fo r analog input control (ainds). 2. set up the ad converter control register 2 (adccr2) as follows: ? set the ad conversion time using ad conversion time (ack). for details on how to set the con- version time, refer to table 12-1. ? choose irefon for da converter control. 3. after setting up 1. and 2. above, set ad conversion start (adrs) of ad converter control register 1 (adccr1) to ?1?. 4. after an elapse of the specified ad conversion time, the ad converted value is stored in ad con- verted value register 1 (adcdr1) and the ad conv ersion finished flag (e ocf) of ad converted value register 2 (adcdr2) is set to ?1?, upon wh ich time ad conversion interrupt intadc is gener- ated. 5. eocf is cleared to ?0? by a read of the conversion result. however, if reconverted before a register read, although eocf is cl eared the previous conversi on result is retained until the next conversion is completed. adcdr1 status eocf cleared by reading conversion result conversion result read conversion result read adcdr2 intadc interrupt reading adcdr1 reading adcdr2 adcdr2 adccr1 first conversion result second conversion result indeterminate ad conversion start ad conversion start
page 125 TMP86P807MG 12.3.3 stop and slow m ode during ad conversion when the stop or slow mode is entered forcibly du ring ad conversion, the ad convert operation is sus- pended and the ad converter is initialized (adccr1 and adccr2 are initialized to initial value.). also, the conversion result is indeterminate. (c onversion results up to the previous operation are cleared, so be sure to read the conversion results before entering stop or slow mode.) when restored from stop or slow mode, ad conversion is not automatically restarted, so it is necessary to restart ad conversion. note that since the analog reference voltage is automa tically disconnected, there is no possibility of current flowing into the analog reference voltage. example :after selecting the conversion time of 19.5 s at 16 mhz and the analog input channel ain3 pin, perform ad conversion once. after checking eocf, read the converted value and store the 8-bit data in address 009fh on ram. ; ain select : : : : ; before setting the ad converter register, set each port reg- ister suitably (for detail, see chapter of i/o port.) ld (adccr1), 00100011b ; select ain3 ld (adccr2), 11011000b ; select conversion time (312/fc) and operation mode ; ad convert start set (adccr1). 7 ; adrs = 1 sloop: test (adcdr2). 5 ; eocf = 1 ? jrs t, sloop ; result data read ld a, (adcdr1) ld (9fh), a
page 126 12. 8-bit ad converter (adc) 12.3 function TMP86P807MG 12.3.4 analog input volt age and ad conversion result the analog input voltage is corresponded to the 8-bit digital value converted by the ad as shown in figure 12-3. figure 12-3 analog i nput voltage and ad conv ersion result (typ.) 1 0 01h 02h 03h fdh feh ffh 2 3 253 254 255 256 analog input voltage ad conversion result 256 vdd vss
page 127 TMP86P807MG 12.4 precautions about ad converter 12.4.1 analog input pin voltage range make sure the analog input pins (ain0 to ain5) are used at voltages within vss below vdd. if any voltage outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncertain. the other analog input pins also are affected by that. 12.4.2 analog input shared pins the analog input pins (ain0 to ain5) are shared wi th input/output ports. when using any of the analog inputs to execute ad convers ion, do not execute in put/output instructions for all other ports. this is necessary to prevent the accuracy of ad conversi on from degrading. not only these analog input shared pins, some other pins may also be affected by noise arising from input/o utput to and from adjacent pins. 12.4.3 noise countermeasure the internal equivalent circuit of the analog input pins is shown in figure 12-4. the higher the output imped- ance of the analog input source, more easily they are su sceptible to noise. therefor e, make sure the output impedance of the signal source in your design is 5 k ? or less. toshiba also reco mmends attaching a capacitor external to the chip. figure 12-4 analog input equivalent ci rcuit and example of input pin processing da converter ainx analog comparator internal resistance allowable signal source impedance internal capacitance 5 k ? (typ) c = 22 pf (typ.) 5 k ? (max) note) i = 5~0
page 128 12. 8-bit ad converter (adc) 12.4 precautions about ad converter TMP86P807MG
page 129 TMP86P807MG 13. key-on wakeup (kwu) TMP86P807MG have four pins p34 to p37, in addition to the p20 ( int5 / stop ) pin, that can be used to exit stop mode. when using these p34 to p37 pin?s input to exit stop mode, pay attention to the logic of p20 pin. in details, refer to the following section" 13.2 control ". 13.1 configuration figure 13-1 key-on wakeup circuit figure 13-2 example of st op mode release operation int5 p20 (int5/stop) p34 (ain2/stop2) p35 (ain3/stop3) stop mode release signal (1: release) stop mode control qd s stop2(stopcr) stop signal qd s stop3(stopcr) stop signal p36 (ain4/stop4) qd s stop4(stopcr) stop signal p37 (ain5/stop5) qd s stop5(stopcr) stop signal stop mode release operation(p34 to 37) example of stop mode release operation "l" "h" "l" rising or falling edge detect stop wake-up* operation the time required for wakeup from releasing stop mode includes the warming-up time. for details, refer to section "control of operation modes". p3i *
page 130 13. key-on wakeup (kwu) 13.2 control TMP86P807MG 13.2 control the p34 to p37 (stop2 to stop5) pins can individuall y be disabled/enabled using key-on wakeup control reg- ister (stopcr). before these pins can be used to place th e device out of stop mode, th ey must be set for input using the p3 port input/out put register (p3cr), p3port output latc h (p3dr), ad contro l register (adccr1). stop mode can be entered by setting up the system contro l register (syscr1), and ca n be released by detecting the active edge (rising or falling edge) on any stop2 to st op5 pins which are available for stop mode release. note: when using key-on wakeup function, select level mode ( set syscr1 to "1" ) for selection of stop mode release method. although p20 pin is shared with int5 and stop pin input, use mainly stop pin to release stop mode. this is because key-on wakeup fu nction is comprised of stop pin and stop2 to stop5 pins as shown in the configuration diagram. note 1: when stop mode release by an edge on stop pi n, follow one of the two methods described below. (1) disable all of stop2 to 5 pin inputs. (2) fix stop2 to 5 pin inputs high or low level. note 2: when using key-on wakeup (stop2 to 5 pins) to exit stop mode, make sure stop pin is held low and stop2 to 5 pin inputs are held high or low level, because stop mode release signal is created by oring the stop pin input and the stop2 to 5 pin input together. note: assertion of the stop mode release si gnal is not recognized within three inst ruction cycles after executing the stop instruction. key-on wakeup stop mode control register stopcr76543210 (0031h) stop5 stop4 stop3 stop2 (initial value : 0000 ****) stop2 stop mode release by p34 (stop2) 0: disable write only 1: enable stop3 stop mode release by p35 (stop3) 0: disable 1: enable stop4 stop mode release by p36 (stop4) 0: disable 1: enable stop5 stop mode release by p37 (stop5) 0: disable 1: enable the device is released from stop mode in the following condition. p20( stop )p3x stop mode release using p3x (stop2 to 5) level detection mode: low edge detection mode: disable edge detection rising or falling edge stop mode release using p20 ( stop ) level detection mode: high edge detection mode: rising edge stopcr: inhibited
page 131 TMP86P807MG 14. otp operation this section describes the funstion and basic opera tionalblocks of tmp86p807m g. the TMP86P807MG has prom in place of the mask rom which is included in the tmp86c407/807mg. the configuration and function are the same as the tmp86c407/807mg. in addition, TMP86P807MG operates as the single clock mode when releasing reset. when using the dual clock mode, oscill ate a low-frequency clock by [ set. (syscr2). xten ] command at the beginning of program. 14.1 operating mode the TMP86P807MG has mcu mode and prom mode. 14.1.1 mcu mode the mcu mode is set by fixing the test/vpp pin to the low level. (test/vpp pin cannot be used open because it has no built-in pull-down resistor). 14.1.1.1 program memory the TMP86P807MG has 8k bytes built-in one-ti me-prom (addresses e000 to ffffh in the mcu mode, addresses 0000 to 1fffh in the prom mode). when using TMP86P807MG for evaluation of mask rom products, the program is written in the pro- gram storing area shown in figure 14-1. since the TMP86P807MG supports several mask ro m sizes, check the difference in memory size and program storing area between the one-time prom and the mask rom to be used. figure 14-1 prog ram memory area (a) rom size = 8 kbytes program 0000h e000h ffffh mcu mode program prom mode program 0000h 1fffh (b) rom size = 4 kbytes program 0000h f000h ffffh mcu mode program 0000h f000h ffffh prom mode program don?t use 0000h 1000h 1fffh 0000h e000h ffffh mask rom mask rom don?t use ffffh don?t use ffffh
page 132 14. otp operation 14.1 operating mode TMP86P807MG note: the area that is not in use should be set data to ffh, or a general-purpose prom programmer should be set only in the program memory area to access. 14.1.1.2 data memory TMP86P807MG has a built-in 256 bytes data memory (static ram). 14.1.1.3 input/output circuiry 1. control pins the control pins of the TMP86P807MG are the same as those of the tmp86c407/807mg except that the test pin does not have a built-in pull-down resistor. 2. i/o ports the i/o circuitries of the TMP86P807MG i/ o ports are the same as those of the tmp86c407/807mg. 14.1.2 prom mode the prom mode is set by setting the reset pin, test pin and other pins as shown in table 14-1 and fig- ure 14-2. the programming and verification for the in ternal prom is acheived by using a general-purpose prom programmer with the adaptor socket. note 1: the high-speed program mode can be used. the setti ng is different according to the type of prom pro- grammer to use, refer to each description of prom programmer. TMP86P807MG does not support the electric signature mode, apply the rom type of prom programmer to tc571000d/ad. table 14-1 pin name in prom mode pin name (prom mode) i/o function pin name (mcu mode) a16 input program memory address input p37 a15 to a8 input program memory address input p07 to p00 a7 to a0 input program memory address input p07 to p00 d7 to d0 input/output program memory data input/output p07 to p00 ce input chip enable signal input p34 oe input output enable signal input p33 pgm input program mode signal input p35 dids input prom mode control signal input p32 vpp power supply +12.75v/5v (power supply of program) test vcc power supply +6.25v/5v vdd gnd power supply 0v vss vcc setting pin fix to "h" level in prom mode p11,p21 gnd setting pin fix to "l" level in prom mode p10,p12,p20,p22,p36 reset setting pin fix to "l" level in prom mode reset xin (clk) input set oscillation with resonator in case of external clk input, set clk to xin and set xout to open. xin xout output xout
page 133 TMP86P807MG always set the adapter socket switch to the "n" side when using toshiba?s adaptor socket. note 1: eprom adaptor socket (tc571000 ? 1m bit eprom) note 2: prom programmer connection adaptor sockets bm111684 for TMP86P807MG note 3: inside pin name for TMP86P807MG note 4: outside pin name for eprom figure 14-2 prom mode setting v cc xin xout ce oe refer to pin function for the other pin setting. vss test v pp (12.5 v/5 v) a16 g nd pgm ~ dids v cc setting pins gnd setting pins a15 a7 d7 a8 a0 d0 ~ ~ ~ TMP86P807MG p37 p07 p00 p34 p33 p35 p32 16 mhz
page 134 14. otp operation 14.1 operating mode TMP86P807MG 14.1.2.1 programming flowchart (high-speed program writing) figure 14-3 prog ramming flowchart the high-speed programming mode is set by applying vpp=12.75v (programming voltage) to the vpp pin when the vcc = 6.25 v. after th e address and data are fixed, the data in the address is written by applying 0.1[msec] of low level program pulse to pgm pin. then verify if the data is written. if the programmed data is incorrect, a nother 0.1[msec] pulse is applied to pgm pin. this programming procedure is repeated until correct data is r ead from the address (maximum of 25 times). subsequently, all data are programmed in all address. when all data were written, verfy all address under the condition vcc=vpp=5v. v cc = 6.25 v yes no error verify n = 25? ok start v pp = 12.75 v address = start address n = 0 program 0.1 ms pulse n = n + 1 last address ? yes v cc = 5 v v pp = 5 v read all data ok address = address + 1 no pass fail error
page 135 TMP86P807MG 14.1.2.2 program writing using a general-purpose prom programmer 1. recommended otp adaptor bm111684 for TMP86P807MG 2. setting of otp adaptor set the switch (sw1) to "n" side. 3. setting of prom programmer a. set prom type to tc571000d/ad. vpp: 12.75 v (high-speed program writing mode) b. data transmission ( or copy) (note 1) the prom of TMP86P807MG is located on different address; it depends on operating mode: mcu mode and prom mode. when you write the data of rom for mask rom prod- ucts, the data shuold be transferred (or copied ) from the address for mcu mode to that for prom mode before writing operation is execute d. for the applicable program areas of mcu mode and prom mode are different, refer to TMP86P807MG" figure 14-1 program mem- ory area ". example: in the block transfer (copy) mode, executed as below. 8kb rom capacity : 0e000~0ffffh 00000~01fffh 4kb rom capacity : 0f000~0ffffh 01000~01fffh c. setting of the program address (note 1) start address: 0000h (when 4kb rom capacity, start address is 1000h) end address: 1fffh 4. writting write and verify according to the above procedure "setting of prom programmer". note 1: for the setting method, refer to each description of prom programmer. make sure to set the data of address area that is not in use to ffh. note 2: when setting mcu to the adaptor or when setting the adaptor to the prom programmer, set the first pin of the adaptor and that of prom programmer sock et matched. if the first pin is conversely set, mcu or adaptor or programmer would be damaged. note 3: the TMP86P807MG does not s upport the electric signature mode. if prom programmer uses the signature, the de vice would be damaged because of applying voltage of 12 0.5v to pin 9(a9) of the address. don?t use the signature.
page 136 14. otp operation 14.1 operating mode TMP86P807MG
page 137 TMP86P807MG 15. input/output circuitry 15.1 control pins the input/output circuitries of the TMP86P807MG control pins are shown below. control pin i/o input/output circuitry remarks xin xout input output resonator connecting pins r f = 1.2 m ? (typ.) r o = 0.5 k ? (typ.) xtin xtout input resonator connecting pins r f = 6 m ? (typ.) r o = 220 k ? (typ.) reset input hysteresis input pull-up resistor r in = 220 k ? (typ.) r = 100 ? (typ.) test input without pull-down resistor r = 100 ? (typ.) fix the test pin at low-level in mcu mode. fc rf r o osc.enable xin xout vdd vdd fs rf r o osc.enable xtin xten xtout vdd vdd r in r vdd address trap reset watchdog timer reset system clock reset r
page 138 15. input/output circuitry 15.2 input/output ports TMP86P807MG 15.2 input/output ports note: input status on pins set for input mode are read in into the internal circuit. therefore, when using the ports in a maxtur e of input and output modes, the contents of the output latches for t he ports that are set for input mode may be rewritten by exe- cution of bit manipulating instructions. control pin i/o input/output circuitry remarks p0 i/o sink open drain output or push-pull output hysteresis input high current output(nch) (programmable port option) r = 100 ? (typ.) p1 i/o tri-state i/o hysteresis input r = 100 ? (typ.) p2 i/o sink open drain output hysteresis input r = 100 ? (typ.) p3 i/o tri-state i/o hysteresis input r = 100 ? (typ.) initial "high-z" high-z control vdd r pch control data output input from output latch pin input initial "high-z" disable vdd r data output pin input initial "high-z" vdd r data output input from output latch pin input initial "high-z" disable vdd r data output pin input
page 139 TMP86P807MG 16. electrical characteristics 16.1 absolute maximum ratings the absolute maximum ratings are rated values which must not be exceeded during operat ion, even for an instant. any one of the ratings must not be exceeded. if any absolute maximum rati ng is exceeded, a device may break down or its performance may be degraded, causi ng it to catch fire or explode resul ting in injury to the user. thus, when designing products which include this de vice, ensure that no absolute maximu m rating value will ever be exceeded. (v ss = 0 v) parameter symbol pins ratings unit supply voltage v dd ? 0.3 to 6.5 v program voltage v pp test/v pp ? 0.3 to 13.0 input voltage v in ? 0.3 to v dd + 0.3 output voltage v out ? 0.3 to v dd + 0.3 output current (per 1 pin) i out1 p0, p1, p3 port ? 1.8 ma i out2 p1, p2, p3 port 3.2 i out3 p0 port 30 output current (total) i out1 p0, p1, p3 port ? 30 i out2 p1, p2, p3 port 60 i out3 p0 port 80 power dissipation [topr = 85 c] p d sop 180 mw soldering temperature (time) tsld 260 (10 s) c storage temperature tstg ? 55 to 150 operating temperature topr ? 40 to 85
page 140 16. electrical characteristics 16.1 absolute maximum ratings TMP86P807MG 16.2 operating condition the operating conditions show the conditions under which the device be used in orde r for it to operate normally while maintaining its quality. if the device is used outsid e the range of operating conditions (power supply voltage, operating temperature range, or ac/dc rated values), it may operate erratically. therefore, when designing your application equipment, always make sure its intended working conditio ns will not exceed th e range of operating conditions. (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol pins condition min max unit supply voltage v dd fc=16mhz normal 1,2 mode 4.5 5.5 v idle 0,1,2 mode fc=8mhz normal 1,2 mode 2.7 idle 0,1,2 mode fs=32.768 khz slow 1,2 mode sleep 0,1,2 mode stop mode input high level v ih1 except hysteresis input v dd 4.5 v v dd 0.70 v dd v v ih2 hysteresis input v dd 0.75 v ih3 v dd < 4.5 v v dd 0.90 input low level v il1 except hysteresis input v dd 4.5 v 0 v dd 0.30 v il2 hysteresis input v dd 0.25 v il3 v dd < 4.5 v v dd 0.10 clock frequency fc xin, xout v dd = 4.5 v to 5.5 v 1.0 16.0 mhz v dd = 2.7 v to 5.5 v 8.0 fs xtin, xtout v dd = 2.7 v to 5.5 v 30 34 khz
page 141 TMP86P807MG 16.3 dc characteristics note 1: typical values show those at topr = 25 c, v dd = 5 v note 2: input current (i in1 , i in3 ); the current through pull-up or pull-down resistor is not included. note 3: i dd does not include i ref current. note 4: the power supply current in stop2 and sleep2 modes each are the same as in idle0,1 and 2 modes. (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol pins condition min typ. max unit hysteresis voltage v hs hysteresis input ? 0.9 ? v input current i in1 test v dd = 5.5 v, v in = 5.5 v/0 v ?? 2 a i in2 sink open drain, tri-state port i in3 reset , stop input resistance r in reset pull-up 100 220 450 k ? output leakage current i lo sink open drain, tri-state port v dd = 5.5 v, v out = 5.5 v/0 v ?? 2 a output high voltage v oh p0, p1, p3 port v dd = 4.5 v, i oh = ? 0.7 ma 4.1 ? ? v output low voltage v ol p1, p2, p3 port v dd = 4.5 v, i ol = 1.6 ma ??0.4 output low current i ol high current port (p0 port) v dd = 4.5 v, v ol = 1.0 v ?20?ma supply current in normal 1,2 mode i dd v dd = 5.5 v v in = 5.3 v/0.2 v fc = 16.0 mhz fs = 32.768 khz ?7.59.0 ma supply current in idle 0, 1,2 mode ?5.56.5 supply current in slow 1 mode v dd = 3.0 v v in = 2.8 v/0.2 v fs = 32.768 khz ? 14.0 25.0 a supply current in sleep 1 mode ? 7.0 15.0 supply current in sleep 0 mode ? 6.0 150 supply current in stop mode v dd = 5.5 v v in = 5.3 v/0.2 v ? 0.5 10.0 a
page 142 16. electrical characteristics 16.5 sei operating condition (slave mode) TMP86P807MG 16.4 ad conversi on characteristics note 1: the total error includes all errors except a quantizati on error, and is defined as a maximum deviation from the ideal co n- version line. note 2: conversion time is different in recommended value by power supply voltage. about conversion time, please refe r to ?register configuration?. note 3: please use input voltage to ain input pin in limit of v dd ? v ss . when voltage of range outside is input, conversion value bec omes unsettled and gives affect to other channel conversion value. note 4: the relevant pin for i ref is v dd , so that the current flowing into v dd is the power supply current i dd + i ref . 16.5 sei operating c ondition (slave mode) (v ss = 0.0 v, v dd = 4.5 to 5.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit analog input voltage v ain v ss ? v dd v power supply current of analog reference voltage i ref v dd = 5.5 v v ss = 0.0 v ?0.61.0ma non linearity error v dd = 5.0 v, v ss = 0.0 v ?? 1 lsb zero point error ?? 1 full scale error ?? 1 total error ?? 2 (v ss = 0.0 v, v dd = 2.7 to 4.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit analog input voltage v ain v ss ? v dd v power supply current of analog reference voltage i ref v dd = 4.5 v v ss = 0.0 v ?0.50.8ma non linearity error v dd = 2.7 v, v ss = 0.0 v ?? 1 lsb zero point error ?? 1 full scale error ?? 1 total error ?? 2 (v ss = 0 v, v dd = 2.7 to 5.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit transfer rate 15.625k ? fc/4 bps
page 143 TMP86P807MG 16.6 ac characteristics (v ss = 0 v, v dd = 4.5 to 5.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit machine cycle time tcy normal 1,2 mode 0.25 ? 4 s idle 0,1,2 mode slow 1,2 mode 117.6 ? 133.3 sleep 0,1,2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 16 mhz 25 ? ? ns low level clock pulse width t wcl high level clock pulse width t wsh for external clock operation (xtin input) fs = 32.768 khz 14.7 ? ? s low level clock pulse width t wsl (v ss = 0 v, v dd = 2.7 to 4.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit machine cycle time tcy normal 1,2 mode 0.5 ? 4 s idle 0,1,2 mode slow 1,2 mode 117.6 ? 133.3 sleep 0,1,2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 8 mhz 50 ? ? ns low level clock pulse width t wcl high level clock pulse width t wsh for external clock operation (xtin input) fs = 32.768 khz 14.7 ? ? s low level clock pulse width t wsl
page 144 16. electrical characteristics 16.5 sei operating condition (slave mode) TMP86P807MG 16.7 dc characteristics, ac characteristi cs (prom mode) 16.7.1 read operat ion in prom mode note: tcyc = 250 ns, f clk = 16 mhz note:dids and p07 to p00 are the signals for the TMP86P807MG. all other signals are eprom programmable. al: address input (a0 to a7) ah: address input (a8 to a15) (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit high level input voltage v ih4 v cc 0.75 ? v cc v low level input voltage v il4 0? v cc 0.25 power supply v cc 4.75 5.0 5.25 program supply of program v pp address access time t acc v cc = 5.0 0.25 v ?? 1.5tcyc + 300 ns address input cycle ? ? tcyc ? ah a16 to a0 p07 to p00 dids ce pgm oe al data output t acc address input cycle
page 145 TMP86P807MG 16.7.2 program operation (high-speed) (topr = 25 5 c) note: tcyc = 250 ns, f clk = 16 mhz note:dids and p07 to p00 are the signals for the TMP86P807MG. all other signals are eprom programmable. al: address input (a0 to a7) ah: address input (a8 to a15) note 1: the power supply of v pp (12.75 v) must be set power-on at the same time or the later time for a power sup- ply of v cc and must be clear power-on at the same time or early time for a power supply of v cc . note 2: the pulling up/down device on the condition of v pp = 12.75 v 0.25 v causes a damage for the device. do not pull up/down at programming. note 3: use the recommended adapter and mode. using other than the above condition ma y cause the trouble of the writting. parameter symbol condition min typ. max unit high level input voltage v ih4 v cc 0.75 ? v cc v low level input voltage v il4 0? v cc 0.25 power supply v cc 6.0 6.25 6.5 program supply of program v pp 12.5 12.75 13.0 pulse width of initializing program t pw v cc = 6.0 v 0.095 0.1 0.105 ms address set up time t as 0.5tcyc ? ? ns address input cycle ? ? tcyc ? data set up time t ds 1.5tcyc ? ? oe to valid output data t oe ?? 1.5tcyc + 300 ah a16 to a0 p07 to p00 dids high-speed program writing ce pgm v pp oe al input data data outputs address input cycle program verify t pw t oe t ds t as
page 146 16. electrical characteristics 16.8 recommended oscillation conditions TMP86P807MG 16.8 recommended osc illation conditions note 1: to ensure stable oscillation, the resonator position, load capacitance, etc. must be appropriate. because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will act ually be mounted. note 2: for the resonators to be used with toshiba microcont rollers, we recommend ceramic resonators manufactured by murata manufacturing co., ltd. for details, please visit the website of murata at the following url: http://www.murata.com 16.9 handling precaution - the solderability test conditions for lead-free produc ts (indicated by the suffix g in product name) are shown below. 1. when using the sn-37pb solder bath solder bath temperature = 230 c dipping time = 5 seconds number of times = once r-type flux used 2. when using the sn-3.0ag-0.5cu solder bath solder bath temperature = 245 c dipping time = 5 seconds number of times = once r-type flux used note: the pass criteron of the above test is as follows: solderability rate until forming 95 % - when using the device (oscillator) in places exposed to high electric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition. (1) high-frequency oscillation xin xout c 2 c 1 xtin xtout c 2 c 1 (2) low-frequency oscillation
page 147 TMP86P807MG 17. package dimensions 28 15 0.995typ 1 14 1.27 0.2 19.0max 0.10 11.43 (450mil) 0.15 +0.08 - 0.04 0.1 +0.1 - 0.05 0.43 +0.1 - 0.06 2.4 0.2 2.7max m unit : mm 0.8 0.2 18.5 0.2 8.8 0.2 11.8 0.2 sop28-p-450-1.27b rev 01
page 148 17. package dimensions TMP86P807MG
this is a technical document that de scribes the operating functi ons and electrical specif ications of the 8-bit microcontroller series tlcs-870/c (lsi). toshiba provides a variety of development tools a nd basic software to enable efficient software development. these development tools have specifi cations that support advances in microcomputer hardware (lsi) and can be used extensively. both the hardware and so ftware are supported continuous ly with version updates. the recent advances in cmos lsi production technology have be en phenomenal and microcomputer systems for lsi design are constant ly being improved. the products described in this document may also be revised in the future. be sure to check the latest specific ations before using. toshiba is developing highly integrated, high-perfo rmance microcomputers using advanced mos production technology and especially well proven cmos technology. we are prepared to meet the requests for custom packaging for a variet y of application areas. we are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP86P807MG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X